Howdy all,
I've bee

*Question*
How do I execute init.py and menu.py manually when new plugins are added
after nuke has been loaded?

*Background*
I've been setting up a nuke environment that can dynamically load plugins
off the server based on the version of nuke that is being run. This is
nearly imperative for quickly swapping plugins on a large farm. My code is
working as expected unless I decide to execute it after the nuke UI is
fully loaded.

*Example Code*
import nuke
myPath = "/path/to/nuke/plugin"
nuke.pluginAddPath(myPath)

As mentioned if this is added to the user init.py or menu.py, any
additional menu.py or init.py files will be read and executed. However if I
execute this after nuke is fully loaded, the extra init.py and menu.py
files are totally ignored.

*Half-assed workaround*
To get the functionality that I want, I can manually execfile on any
init.py or menu.py file that are found, but it does not seem like the right
answer.

*Example Hack*
import os
import nuke
myPath = "/path/to/nuke/plugin"
nuke.pluginAddPath(myPath)

for x in ['init.py', 'menu.py']:
    testFile = os.path.join(myPath,x)
    if os.path.isfile(testFile):
        execfile(testFile)
    pass

Can anyone offer a better solution?
Cheers,
Jesse
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to