AnsweredAssumed Answered

Launch python toolbox from toolbar: can it be done?

Question asked by jkraemer on Oct 17, 2012
Latest reply on Oct 17, 2012 by jkraemer
I need to put a button on a toolbar to launch my new python toolbox tool that maps condos. I have found this to be impossible, and am hoping for help...

I've tried building an add-in to launch the pyt, but in testing it I get a pop-up error "Failed to open toolbox Condos.pyt". Perhaps this means add-ins simply do not support python toolboxes, or maybe I've incorrectly specified the path in the add-in's onClick def:

toolboxPath = os.path.join(os.path.dirname(__file__), toolboxName + ".pyt")


The reason I'm uncertain about the path is that the pyt is in "My Toolboxes", and I don't know whether this code actually points there (I'm very new to python). Or maybe a pyt is merely incompatible here, because the example code has ".tbx" in the above line. Any ideas?

To re-write my pyt as a regular python script in a tbx and set up params that way has certainly occurred to me and would probably work, but would be a huge disappointment given the time invested in the pyt that works so nicely. How can I launch from a toolbar button the CondoBuilderTool of Condos.pyt? Is that even possible? Please help me with some suggestions here. How can I resolve this?

Thanks in advance,
Justin

Outcomes