I have made a set of tools in a toolbox using ArcGIS 10.2 using the model builder.

I would like to distribute them as a tool bar, and so created a ArcGIS Python Add-In I was hoping that I could export the tools as python scripts and copy the code into the Add-In. However, it does not seem to be as simple as that.

Is it possible with Python Add-Ins to make a window for entering in parameters and run a script in the way tools/toolboxes work?


I found a useful blog post.

This is my code

import arcpy
import pythonaddins
import os.path

class multiplebenefits(object):
    """Implementation for ArcGISAddin_addin.multiplebenefits (Tool)"""
    def __init__(self):
        self.enabled = True
        self.checked = False

    def onClick(self):
       # name of toolbox without tbx extension
       toolboxName = "mytoolbox"
       # name of tool to be executed
       toolName = "mymodel"
       # create string with path to toolbox
       toolboxPath = os.path.join(os.path.dirname(__file__), toolboxName + ".tbx")
       # call geoprocessing tool
       pythonaddins.GPToolDialog(toolboxPath, toolName)

But I get an error message:

Failed to open tool mymodel (mytoolbox.tbx)

TypeError: GPToolDialog() takes at most 1 argument (2 given)

  • 1
    It's saying it can't find the toolbox, what is the value of file and is the toolbox there? Perhaps hard-code the path to the toolbox to see if that's what's causing the problem for now and fix it up before distributing. The documentation says it's possible and this looks fairly close to the bottom example on resources.arcgis.com/en/help/main/10.1/index.html#//… so I can't see why it wouldn't work should it be able to find the toolbox. Apr 17, 2015 at 1:38

1 Answer 1


The TypeError: GPToolDialog() takes at most 1 argument (2 given) error was caused by an error in the toolName value, this is not the name as it appears in the tool box, it must be set in the Model Properties.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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