Jump to content

(SOLVED) Python Script run, then wait for TOPS to finish the continue?

Recommended Posts


I'm trying to run a python script that does some code, runs a TOPS and then waits for said TOPs to finish then continue the rest of the script. Any ideas on how I could go about that? I've tried time but i guess it's on the same thread so it freezes Houdini. Here's a simplified script giving you the gist of what I'm looking for.


import hou
import time

node = hou.selectedNodes()[0]

hip = hou.hipFile.path()

cooking = True
failed = False

while cooking:
    for i in range(60):
        if node.getCookState(1) != hou.topCookState.Cooking:
            print("Cook finished")
            cooking = False
    if node.getCookState(1) == hou.topCookState.Cooking:
        print("Times up")
        failed = True
    cooking = False

print("Continue the rest of the script")



Using the .CookOutputWorkItems(block=True) solved my issue.

Edited by shadowst17
Link to comment
Share on other sites

  • shadowst17 changed the title to (SOLVED) Python Script run, then wait for TOPS to finish the continue?

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...