haggi Posted April 2, 2020 Share Posted April 2, 2020 Hi, I'd like to execute a shelf button from python? Is this possible? Quote Link to comment Share on other sites More sharing options...
DonRomano Posted April 2, 2020 Share Posted April 2, 2020 my_shelf_tool = hou.shelves.tool("my_shelf_tool_internal_name") my_script = my_shelf_tool.script() exec(my_script) or hou.SceneViewer.runShelfTool("my_internal_shelf_tool_name") Quote Link to comment Share on other sites More sharing options...
haggi Posted April 2, 2020 Author Share Posted April 2, 2020 Thanks, that was fast. Unfortunately I have problems with both methods. The first method gives me (with a simple test tool which creates a sphere): >>> st = hou.shelves.tool("converter") >>> s=st.script() >>> exec(s) Traceback (most recent call last): File "<console>", line 1, in <module> File "<string>", line 12, in <module> NameError: name 'kwargs' is not defined >>> And the other one seems only to work from within the UI, but I'd like to execute the shelf button from hython commandline. Quote Link to comment Share on other sites More sharing options...
DonRomano Posted April 2, 2020 Share Posted April 2, 2020 Yeah I see, I'm getting this error too, because I guess the shelf tool needs some sort of info to set up kwargs and executing it from a script doesn't seem to give it the info. Why not creating a normal script and then executing it with hython instead of creating a shelf tool ? Quote Link to comment Share on other sites More sharing options...
haggi Posted April 2, 2020 Author Share Posted April 2, 2020 I just set the kwargs with: kwargs={} and it seems to work 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.