Load the python file saved using hou.Node.asCode()

   2792   1   0
User Avatar
Member
1 posts
Joined: 6月 2021
Offline
Hi Folks!

I'm trying to serialize and save nodes to disk using the hou.Node.asCode()

When I save a node to disk using asCode() like this:
node_to_disk.asCode(False, True)
I can load the saved file from a shelf tool using the code:
execfile(file_path)
But if I want to wrap that code in a function, using
node_to_disk.asCode(False, True, function_name="func_name")
It saves the python file as expected.

But how do I load this file in houdini again?? If I try to call that function, I get an error saying hou is not defined.
Also, if I have multiple functions in that file, can I just call one at a time?

Any help will be appreciated.
Thanks!
User Avatar
Member
5 posts
Joined: 8月 2017
Online
Bump...

Did you ever come up with an answer for this?

Thanks,
Nick
  • Quick Links