jmquintela Posted April 28, 2022 Share Posted April 28, 2022 (edited) Hi, I try to run a python script on the Post render script on a File Cache node to make shure the node data gets updated when passing to the text node( I'm having this problem when doing a chain of fetchs in a rop ) .. I add this on the script box ... execfile("$JOB/scripts/reload.py") ... and check Python lenguaje , and the script has this : import hou hou.parm("reload").pressButton() iis not working, what I'm doing wrong? Edited May 4, 2022 by jmquintela Quote Link to comment Share on other sites More sharing options...
Adam Ferestad Posted May 2, 2022 Share Posted May 2, 2022 I had a similar issue recently and this was how I got it working. It probably is way more than needed, but it works like a charm. You have to put the below on a default python module on the node you want to work with. Then load the reload.py as another python module. This code links the two. import importlib.util spec = importlib.util.spec_from_file_location("foo", "path/to/your/script.py") GE = importlib.util.module_from_spec(spec) spec.loader.exec_module(GE) def callback(): GE.foo() Then the callback is hou.phm().callback() in your case, you would use hou.node('path/to/your/node').phm().callback() Quote Link to comment Share on other sites More sharing options...
jmquintela Posted May 4, 2022 Author Share Posted May 4, 2022 (edited) Thanks Adam!, I'll try this .... edit:I try it and it's working like a charm as you say. .. thanks a lot for it :D!, you save me a lot of time! Edited May 4, 2022 by jmquintela answer update Quote Link to comment Share on other sites More sharing options...
jmquintela Posted May 15, 2022 Author Share Posted May 15, 2022 Apparently I didn't test it enough, I just set a few node and a simple rop... but when I try a fetch chain with batch between them it didn't work.... also How can I print something to console form the reload.py file so I can debug if the script is running properly..?? I attach all files in a zip .. remember too the reset the $JOB path.. reloadtest.zip 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.