haggi 37 Posted April 2, 2020 Hi, I'd like to execute a shelf button from python? Is this possible? Share this post Link to post Share on other sites
DonRomano 63 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") Share this post Link to post Share on other sites
haggi 37 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. Share this post Link to post Share on other sites
DonRomano 63 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 ? Share this post Link to post Share on other sites
haggi 37 Posted April 2, 2020 I just set the kwargs with: kwargs={} and it seems to work 1 Share this post Link to post Share on other sites