Allow multiple files for Python toolboxes

1636
2
02-20-2013 10:53 AM
Status: Open
ChrisGarrard
New Contributor III
I would like to be able to put each tool in a Python toolbox in its own file. This way I don't end up with a huge and hard to manage .pyt file if the toolbox contains a lot of tools. Right now I can write other modules and use them in the tool's execute method, which definitely helps, but putting the entire tool in its own file would be a lot better.

I was thinking that maybe a Python toolbox could be a folder that contained all of the required files, kind of like a file geodatabase.
2 Comments
DavidWynne
Have a look at this python toolbox the Spatial Analyst team recently put out.  

What they did, and what you could do is, is write out tool classes into individual .py's.  Then use a from-<py>-import-<tool> style to import in the tool classes.  Then you just have to add  the imported tool class(es) to the toolbox's tools property.

-Dave