Hi Hugo, Seems like your code got garbled up. Any chance you can share it via pastebin.com or something?
I tried your approach but simply adding a function to a python button doesn't make that function available in Nuke. Did you intend to somehow call the function from within the button somehow? Here's a super convoluted way to store a cPickled function in a text box, which works. But I REALLY don't want to store it like this: http://pastebin.com/jdiRM3Cg On Thu, Mar 2, 2017 at 11:42 AM Hugo Léveillé <hu...@fastmail.net> wrote: > One way would be to store it in a pyscript knob > > node = nuke.createNode('NoOp') > > node.addKnob(nuke.PyScript_Knob("script","script",'''def printer(string): > > print string > > > printer("hello123")''')) > > > > -- > Hugo Léveillé > Head of 2D, MELS > > > > > On Thu, Mar 2, 2017, at 05:17, Fredrik Averpil wrote: > > Hi, > > I’m trying to figure out how I can store a function on a node. > > This doesn’t work: > > *def* *printer*(string): print(string) > node = nuke.createNode('NoOp') > node.printer = printer > > Any ideas? > > Cheers, > Fredrik > > *_______________________________________________* > 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