Nuke File Open - Open in another instance of Nuke

How do I get this,
Always open file from SG File Open in a new instance of Nuke and not the current one. Artist want to work on multiple shots together. And closing and reopening in same instance is not feasible.

Please guide, how to approach the same


I’d like to +1 this!

Nuke’s default behaviour is to open a new instance unless we already opened a fresh nuke.

1 Like

Hi Guys,

Good question, at a guess this might be possible by modifying the scene_operation_tk_nuke hook, but I’m not sure what you might need to do, seeing if I can get someone with more knowledge to check it out.


Hi, thanks for +1.
So there is already a file opened. , and if we try to open file from File Open, it asks to save and close the current file and opens the selected file in the same instance. So we want to open in another instance. Hope it is more clear now. Thanks all.

1 Like

Hi Ankur

David is right that the hook he linked is where most of the logic is stored. Basically when you open a new file, it calls this hook twice, first with a reset operation which clears the current script and then a open operation which opens the scene. There is also prepare_new operation that is currently not being used in the hook which you would need to modify for the new file behaviour.

However it isn’t as simple as removing the reset logic. Doing that will mean that it will spawn a new Nuke instance, however it will change the context of the current Nuke instance to match that which it is opening, rather than keeping the current context and only changing it on the newly opened Nuke instance. You would also need to serialize the context and set the TANK_CONTEXT env var in the open and prepare_new operation logic so that the new Nuke instance started in the correct context.

I think in order to do this properly you would need to modify the workfiles app itself so that it didn’t change the context of the current instance when opening or creating a new Nuke instance.


1 Like

Thanks a lot Philip for the detailed guide.
I do see chances of me missing things out in the said workflow. What if there is a command line way, where on clicking on say a version ‘A’ from File Open from Shotgun, it runs a script in background which
a) Launch Nuke instance from SG Desktop
b) And do the SG File Open for the selected task and version ‘A’
all in one go, as if emulating the GUI way in say an external python script so context setting is taken care by SGTK properly.

Please guide if this makes any sense.


Actually another idea I hadn’t thought of, but your suggestion made me think of it.

You could create a custom action via the hook. You would then add the hook setting something like this: custom_actions_hook: "{config}/

I’ve not tried it, but I think if you created a new action called “Open in new window”, and that action when executed would set the TANK_CONTEXT env var, and then run nuke.scriptOpen(file["path"]) then it should launch the new Nuke instance in the correct context and leave the current window in the same context.

To set the TANK_CONTEXT env var you would do the following when the action was run:

os.environ["TANK_CONTEXT"] = context.serialize()

This approach would mean that the normal open logic was still there, but the user would have the option to open in a new Nuke session, via the right-click menu, when you right-click on a file in the File Open dialog.


Awesome, this sounds like a great workflow. I will try it out and let know the outcome. Thanks for everything Philip.

1 Like