I need to open a Python Script using GPToolDialog(), but the script is in a Toolset, not in the Toolbox main path.
I tried many ways to solve but do not work, examples:
Example 1:
pythonaddins.GPToolDialog(r'Path to Toolbox\Toolset', 'Script')
Example 2:
pythonaddins.GPToolDialog(r'Path to Toolbox', 'Toolset\Script')
No one ot the examples works.
Solved! Go to Solution.
Alexander,
Note that I created a Toolset into a Toolbox. I realize that GPToolDialog() calls the script name, even the .py are in or out any Toolset. If my new tool box goes to
Toolbox > Toolset > .py (script)
I can use your code:
import arcpy import pythonaddins pythonaddins.GPToolDialog(r'D:\Toolbox.tbx','.py (script, just the name)')
This code will call the Script name in the Toolbox, independent the location in any toolset. The name is the key.
Many thanks for the help!
Vinicius,
I created a tool box here:
D:\Toolbox
I created a tool set named "Tools" and I added a simple script to the toolbox and named it "test2."
Here is the syntax that opens that script in a GP dialog:
import arcpy
import pythonaddins
pythonaddins.GPToolDialog(r'D:\Toolbox.tbx','test2')
~Alex
Alexander,
Note that I created a Toolset into a Toolbox. I realize that GPToolDialog() calls the script name, even the .py are in or out any Toolset. If my new tool box goes to
Toolbox > Toolset > .py (script)
I can use your code:
import arcpy import pythonaddins pythonaddins.GPToolDialog(r'D:\Toolbox.tbx','.py (script, just the name)')
This code will call the Script name in the Toolbox, independent the location in any toolset. The name is the key.
Many thanks for the help!
Converted the discussion to a question so you can mark an answer as correct when resolved. This helps others located the answer faster.