This section describes the scripts that NUKE runs on start-up.
NUKE initialization scripts are run in reverse order of the NUKE plug-in path. At start-up, the default NUKE plug-in path is as follows:
[‘/home/nukeuser/.nuke’, ‘/usr/local/NUKE/6.2/plugins’, ‘/usr/local/Nuke6.2v4/plugins/user’, ‘/usr/local/Nuke6.2v4/plugins/icons’, ‘/usr/local/Nuke6.2v4/plugins’]
This example shows the NUKE plug-in path for NUKE 6.2v4 and a user called ‘nukeuser’. In this case, scripts in ‘/usr/local/Nuke6.2v4/plugins’ are run first, with scripts in ‘/home/nukeuser/.nuke’ run last.
You can query the plug-in directory using nuke.pluginPath(). If necessary, you can prefix additional directories to the path by calling nuke.pluginAddPath(), or append them using nuke.pluginAppendPath(). You can also edit the path by modifying the NUKE_PATH environment variable.
In each plug-in directory, NUKE first executes the init.py file (if one exists), followed by the menu.py file (again, if one exists).
Any file called init.py that is placed in one of NUKE’s plug-in path directories is automatically read whenever NUKE is launched. In other words, this file is read for both command-line and interactive sessions. Note that you should not use init.py for any commands that create UI elements, as this may lead to errors or prevent NUKE from launching.
Here are some examples of what the init.py file is typically used for (though depending on your workflow, most of these can live in the menu.py file instead if they’re not needed in command-line sessions):