Q100142: How to execute Hiero Python code in NukeStudio on startup
This article explains where to place a script containing Hiero specific Python commands to ensure they will be executed correctly in NukeStudio on startup.
To run Hiero custom Python code in NukeStudio at startup you need to add your code to the following location:
This is the Hiero file structure for Python customisations.
Please note that the above folders do not exist by default and will need to be created manually on first use inside your .nuke directory. More details on accessing your .nuke directory can be found in this article: Q100048: Nuke Directory Locations
- Create a new text file and add your custom Hiero Python code do it.
- Rename the file to init.py and make sure file extensions are shown in your file browser when you do this, to verify that the file extension is .py and not .txt or different.
- At this point you might see a warning message telling you that you are about to change the file type which might make the file unusable. Ignore this as the extension .py is expected and will be recognised by NukeStudio.
Placing custom Python code that is specific to Hiero in the init.py or menu.py files in your .nuke directory leads to the following error when launching NukeStudio9.0v1 and later:
ImportError: No module named _fnpython
Unfortunately, in the release of NukeStudio9.0v1 and later, you cannot launch Terminal mode with a Python script. This is due to the way NukeStudio is currently implemented as the Python modules are loaded after the custom script is executed. This error has been reported as a bug, which you can follow and subscribe for updates via the URL below:
We're sorry to hear that!Please tell us why.