Why does the Nuke integration fail to start when I set the NUKE_PATH environment variable?

Our integrations set the NUKE_PATH environment variable when launching Nuke so that our bootstrap script runs during the Nuke startup process. It’s the tk-multi-launchapp that specifically defines the NUKE_PATH prior to it executing the before_launch_app.py hook.

If you’re setting this environment variable during the launch process using something like os.environ['NUKE_PATH'] = "/my/custom/path", then the ShotGrid integration won’t ever be started, because you’ll have removed our startup script path from the environment variable.

Use this function in tank.util to append or prepend your path to the NUKE_PATH environment variable, while preserving the path to the Toolkit bootstrap:

tank.util.append_path_to_env_var("NUKE_PATH", "/my/custom/path")

Alternately, you can prepend your path using prepend_path_to_env_var().

Edit this document