SUMMARY
This article explains where to place a script containing Hiero specific Python commands to ensure they will be executed correctly in Nuke Studio and Hiero on startup.
MORE INFORMATION
To run custom Hiero Python code in Nuke Studio or Hiero on startup, you will need to add your code to one the following locations in the Hiero file structure for Python customizations:
~/.nuke/Python/Startup
~/.nuke/Python/StartupUI
NOTE: The above folders are not automatically created and will need to be manually created in your .nuke directory once. More details on accessing your .nuke directory can be found in this article: Q100048: Locating the default .nuke directory
The difference between the Startup and StartupUI folders is the order they are scanned in. All of your Startup folders are searched first, and then all of your StartupUI folders. So when deciding which folder to save your code in, you may need to consider any dependencies that your plugins may rely on.
Example Steps:
- Create a new text file and add your custom Hiero Python code to it.
- Save the file to
~/.nuke/Python/Startup/<script_name>.pyor~/.nuke/Python/StartupUI/<script_name>.py
NOTE: Make sure file extensions are shown in your file browser when you do this, and verify that the file extension is .py and not a different extension like .txt. When changing an extension to .py, you might see a warning indicating that you are about to change the file type which might make the file unusable. Ignore this message as the .py extension is expected and will be recognized by Nuke Studio and Hiero. - Launch Nuke Studio or Hiero, and your customization should be automatically loaded.
NOTE: Adding any Python code for Hiero in your ~/.nuke/menu.py or ~/.nuke/init.py will result in the following error when launching Nuke/NukeX/Nuke Studio/Hiero: ImportError: No module named _fnpython
This error occurs because _fnpython is a private module which is created in the application code (similar to _nuke), and the init.py is executed before Hiero's Python modules are properly initialized. This error has been reported as a bug, which you can follow and subscribe for updates via the URL below:
Terminal Mode:
Unfortunately, it is not currently possible to run Hiero or Nuke Studio in terminal mode, however, an internal feature request has been logged for implementing this functionality, which can be referenced as:
ID 138339 - Implement a Headless/Terminal mode for Hiero/Nuke Studio
FURTHER READING
More information about executing Hiero Python code on startup can be found in the Environment Setup section of the Hiero Python Developer Guide.
Please find additional information regarding the init.py and menu.py files here.
We're sorry to hear that
Please tell us why