Hi Erwan! The setScript/script methods can only be called on menu items, not menus. Try the following..
menuItem = nuke.menu('Nuke').addMenu('Test').addCommand("Hi") menuItem.setScript("execfile('script.py')") hth! On 23 July 2015 at 14:51, Erwan Leroy <er...@erwanleroy.com> wrote: > Sorry Everyone, I meant setScript()... > > menu = nuke.menu('Nuke').addMenu('Test') > > menu.setScript("execfile('script.py')") > > # Result: Traceback (most recent call last): > > File "<string>", line 2, in <module> > > RuntimeError: item is not a script command > > *Erwan* LEROY > www.erwanleroy.com > > On Thu, Jul 23, 2015 at 12:46 PM, Erwan Leroy <er...@erwanleroy.com> > wrote: > >> Hello, >> I was trying to use the toScript() Method listed here: >> http://docs.thefoundry.co.uk/nuke/90/pythonreference/nuke.MenuItem-class.html >> >> Whatever I try to pass as an argument, (including the command listed as >> an example in the docs) I get: >> RuntimeError: item is not a script command >> >> I get the same error when using the .script() method. >> >> I was just exploring the capabilities of this function, so far no luck. >> Am I doing something wrong? It seems like it's not accepting strings as an >> argument. >> >> Anyone ever used that method? >> >> >> *Erwan* LEROY >> www.erwanleroy.com >> > > > _______________________________________________ > 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