GeordieM Posted March 6, 2015 Share Posted March 6, 2015 Hi all, I've got a chain of nested OTLs and would like to call Python functions held in a lower level OTL from a higher level one. Example graph: obj/OTL_A/OTL_B/grid OTL_B's pythonModule has a function: # OTL_B Function def setGridSize(gridSize): curNode = hou.node(".") curNode.node(".\grid").parm("sizex").set(gridSize) # I then have a button callback in OTL_A that calls: hou.node("./OTL_B").hdaModule().setGridSize(10) I know there are betters ways to achieve this functionality using exposed parms but just making an example. The issue is that the call to hou.node(".") inside OTL_B returns OTL_A. I've read The threads about the differences between hou.node("."). hou.pwd() and kwargs["node"] and I understand I should use kwargs["node"] like this (I think): # OTL_B Function def setGridSize(gridSize): curNode = kwargs["node"] curNode.node(".\grid").parm("sizex").set(gridSize) # The real problem is that kwargs["node"] does not exist. The kwargs dictionary exists but only has a "type" key. I believe kwargs["node"] works correctly from within callbacks but what about being directly called in a function? TNKS! G Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted March 6, 2015 Share Posted March 6, 2015 Pass the node that calls this function into this function directly from callback as a second parameter, instead of trying to get it inside of it. Quote Link to comment Share on other sites More sharing options...
GeordieM Posted March 9, 2015 Author Share Posted March 9, 2015 Thanks! 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.