Cooking top nodes by script

   2444   3   2
User Avatar
559 posts
Joined: Nov. 2005
Hi, I try to cook nodes with a python script, but … well, it could run better

I attached a file. I would like to open that file and run this python script:
top = hou.node('/obj/topNet/wedge1')

print top.path()
work_items = top.getPDGNode().workItems
print (work_items)

when You run it directly after opening the file, it fails, top.getPDGNode() results in None.
after cooking the top nodes with the ui and deleting the results, the script works.
I wonder, what is going on here. Tt seems that a initial cool by hand, does initialize something so the getPDGNode does work. How can I do this?

thanks for any hints

wedge.hip (66.0 KB)

User Avatar
553 posts
Joined: May 2014
That's because the PDG node graph does not exist until the TOP nodes have cooked – TOP nodes generate the PDG graph. The best way to achieve what you want is to use the TOP Node's execute graph function: []

That will ensure that the TOP node is cooked before attempting the cook the PDG graph, and exposes various options to control the cook. That's what the TOP Fetch node uses, for example, to cook an external TOP network. You can see the implementation of that in $HH/python2.7libs/pdg/job/
User Avatar
559 posts
Joined: Nov. 2005
Thank You!

The “executeGraph” method works fine in a running session, all the PDGNodes are accessible. But I tried to use it in a hda “on loaded” event and again, I get a None back from “getPDGNode” method
The “exectueGraph” method seems to have no effect in a “on loaded” event
is there a way to get that running in this kind of event?
Edited by sanostol - April 10, 2020 08:39:50
User Avatar
4 posts
Joined: June 2013
Hi Martin,

I have the same problem now in h18.5 to executeGraph() "onLoaded" event in HDA.

Have you found any solution?


  • Quick Links