Peter
Peter

Reputation: 3495

Adding startup script (init.py and menu.py) to Nuke path with sitecustomize

I'm trying to point to a startup script location in Nuke instead of using the default one (%USERPROFILE%/.nuke/*.py). From this page, either commands with the nuke module, or adding to the path are said to be valid options.

In my sitecustomize.py, if I run import nuke, I get the message Error: global root initialised more than once, and Nuke will not launch. I believe it could be something to do with the inbuilt _pathsetup.py, which looks like it runs during startup to correctly set the environment for the moudle.

I also tried adding to the NUKE_PATH environment variable, but Nuke just overwrites that before it's properly launched.

Does anyone have any idea how I could add a folder containing init.py and menu.py to the startup path, without specifially editing anything in documents or program files?

I'm currently writing nuke.pluginAppendPath to %USERPROFILE%/.nuke/init.py each time Nuke is launched, but obviously that's not very pythonic.

Upvotes: 2

Views: 2175

Answers (1)

user3585447
user3585447

Reputation: 121

Maybe a good idea to use some conditional expressions in standard init.py file. Like

if nukeverion=12: exec(config2.py)

Upvotes: 0

Related Questions