I've posted this question on GeoNet 4 days ago. At the moment I've received no answers and no comments so I thought I'd try here as well.
I have a tool that works fine from My Tooboxes but we would prefer to run it as an addin button. I found GPToolDialog from the pythonaddins module would do the trick.
I set up the button OK and it runs fine when testing OnClick only using a straight forward script like zooming to selected and no pythonaddins methods.
When I tested the same button’s OnClick only using a one line pythonaddins function it wouldn’t work. Even pythonaddins.MessageBox wouldn’t work.
I thought I’d try running the code in the ArcMap Command Line window and it works fine from there.
My button script
import arcpy import pythonaddins class ButtonClass1(object): """Implementation for Addin_Test_addin.button (Button)""" def __init__(self): self.enabled = True self.checked = False def onClick(self): pythonaddins.GPToolDialog(r'C:\Users\stazicd\AppData\Roaming\ESRI\Desktop10.1\ArcToolbox\My Toolboxes\PVP Zoom.tbx','PVPZoom')
Would any one know why it isn't working?