Atom Posted October 7, 2016 Share Posted October 7, 2016 Hi All, I am playing around with Python callback script for buttons. I place this code in the edit parameter interface. exec(kwargs['node'].parm('python').eval());refreshValue(kwargs['node'].parm('my_slider').eval()) This does work. But from what I can tell, this means that each time I press the button the entire python text is evaluated. So if I have a 2000 line python script in my node but I only want to run a 2 line def the entire script has to be evaluated before that happens. Is there any way around this? As a programmer I imagined that once I type code into a python node it becomes a local module and I should be able to target defs inside it, somehow? But that does not seem to be the case. The text in my python node is just a string until an event happens which cooks the node. Does this mean my python code simply falls out of scope at the end of every cook/refresh? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.