Very helpful, thanks! On Mon, Nov 17, 2014 at 2:18 PM, Nathan Rusch <nathan_ru...@hotmail.com> wrote:
> 1) No. You need to explicitly add subdirectories to the plugin path as > well. However, if your `scripts` directory just contains Python scripts, > you should just use `sys.path.append('/WORK/Nuke/IN_PRODUCTION/scripts/')` > for that directory instead of nuke.pluginAddPath. > > 2) You only need to import them in places that use them. In other words, > you don't necessarily have to import all of your Python scripts during the > init sequence. > > 3) Yes. > > > -Nathan > > > *From:* Matthew Doll <mattd...@gmail.com> > *Sent:* Monday, November 17, 2014 12:45 PM > *To:* Nuke Python discussion <nuke-python@support.thefoundry.co.uk> > *Subject:* [Nuke-python] Importing all scripts from a folder > > Hiya folks, I'm certain this has been answered but I cannot find it in > the archives... > > I am trying to append my plugin path to a generic dumping ground like so: > > nuke.pluginAddPath('/WORK/Nuke/IN_PRODUCTION/') > nuke.pluginAddPath('/WORK/Nuke/IN_PRODUCTION/nodes/') > nuke.pluginAddPath('/WORK/Nuke/IN_PRODUCTION/scripts/') > > Under '/WORK/Nuke/IN_PRODUCTION/' I have a menu.py where I want to import > all the nodes under /nodes/ and scripts under /scripts/ > > My question is threefold: > > -Is there a way to have Nuke use the entire subdirectory for the > pluginAddPath? E.G., only need '/WORK/Nuke/IN_PRODUCTION/' and not the > other two? > > -Under /scripts/ I have several .py files, do I need to explicitly "from > myscript1 import *" for every file in that folder, or is there a way to > bring in all files under that dir? > > -Do I need to explicitly import appropriate modules for each script in .py > file itself? E.G. myscript1.py calls nuke.XYZ(), if I don't put "import > nuke" in that file it throws an error, but "import nuke" is called ahead of > myscript1.py in the menu.py file... > > > Thanks, > Matt > > ------------------------------ > _______________________________________________ > Nuke-python mailing list > Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > > > _______________________________________________ > Nuke-python mailing list > Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > >
_______________________________________________ Nuke-python mailing list Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python