Is it possible to programmatically create an ArcGIS toolbox?

The aim is to write a plugin that works in ArcGIS and have a single source for the tool parameters which is then compiled to an Arc toolbox app.

Alternatively is there a good workaround for this? I note data interoperability in Arc fires up a second dialog from the toolbox dialog: can this be done from the tool validator? As such a dialog could obviously be compiled by an external script, this (almost) fulfils the same purpose.

CLARIFICATION this question is about Arc toolboxes only, as I regard programmatic creation of QGIS/command line interfaces to be a solved problem already.

  • 2
    It is definitely possible to programmatically generate a Python Toolbox, it is just a text file with a .pyt extension. The main piece would be handling the generation of parameter types and tool validation. The source code that would actually need to be ran just goes in the execute method. – crmackey Sep 3 '15 at 19:54
  • 1
    As @crmackey says, the ArcPy part of your question is certainly a Yes, but you have made it to broad by also asking about "QGIS, command line, etc", and even more so by asking about firing up a tool dialog from tool validation. You may need to look into wxPython or Tkinter which are technologies that I do not work with myself. – PolyGeo Sep 3 '15 at 22:10
  • if it's only the parameters which are dynamic, why not have a static toolbox/tool and just pass the parameters? – Adam Sep 3 '15 at 23:23
  • @crmackey nailed it - Python toolbox is the answer. If you add that as an answer I'll accept. I didn't know these existed, to date I have created toolboxes by pointing and clicking in ArcMap. Are python toolboxes a recent addition to ArcGIS? – Sideshow Bob Sep 4 '15 at 14:00
  • 1
    They were added at version 10.1, along with Python Add-Ins. – crmackey Sep 4 '15 at 14:11

As per my comment, I would go with a Python Toolbox. These can be programmatically generated because they are just text files with a .pyt file extension.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.