I'm trying to run a python script where a part of it needs to press the tops network button and wait for it to finish(or times out) before continuing with the rest of the script. I've tried a timer but that doesn't work as it freezes Houdini, I tried using a seperate thread which did keep checking the node but the script being in the main thread just kept going and using thread.join() just causes Houdini to either crash or freeze for good.
import hou import time node = hou.selectedNodes()[0] hip = hou.hipFile.path() hou.hipFile.save(hip) node.parm("cookbutton").pressButton() time.sleep(2) cooking = True failed = False while cooking: for i in range(60): if node.getCookState(1) != hou.topCookState.Cooking: print("Cook finished") cooking = False break time.sleep(2) if node.getCookState(1) == hou.topCookState.Cooking: print("Times up") failed = True cooking = False print("Continue the rest of the script")