As you can see in the python code, I try to create some nodes inside sop net through pdg python script, I'm not sure if this is the right way to use tops but the HDA Processor is just too slow to generate. So I try some weird ways like this. So It works fine when I generate one by one, but it crashes when I generate them all. sometimes I can catch some crash log which is like this:
No, this is not a supported workflow, the reason is that the pythonscript workitems cook in parallel and off the main thread, and this will cause mayhem and probably crash if the functions they use are not thread safe.
Using the houdini command chain would probably be a safer way to go.
Otherwise, you could force your code run on the main thread like so:
Hi, Chris: Thank you for your quick reply and the explanation is quite clear. But I've never heard the module “hdefereval” before, and I want to get more knowledge in depth, is there any documentation to explain this function? Thank you again.
There isn't any documentation, other than a mention that you can use it to defer work until after a dialog is dismissed. It works in this case because it forces the code to run in series on the main thread. Houdini Command Chain with a for loop and command send would work without modifying your running session of Houdini. Let me know if you'd like to see an example of that.