I have a tool I made with a python script called 'myTool' in a toolbox called 'myBox', alias 'box'. I need to run this tool multiple times with the output of one run being one of the inputs of the next run. I would like to write a python script that would run the tool a few times. I have a script called myScript.py
:
import arcpy
myTool_box('input_1.shp', 'base_case.shp', 'output_1.shp') # creates output_1.shp
myTool_box('input_2.shp', 'output_1.shp', 'output_2.shp') # creates output_2.shp
myTool_box('input_3.shp', 'output_2.shp', 'final_output.shp') # creates final_output.shp
When I run execfile(myScript.py)
from the python window, I get the error:
Runtime error
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Projects\myScript.py", line 3, in <module>
arcpy.myTool_box('input_1.shp', 'base_case.shp', 'output_1.shp') # creates output_1.shp
AttributeError: 'module' object has no attribute 'myTool_box'
I assume this means that my_tool
or my custom toolbox isn't on arcpy's path or I need to import the toolbox to the script, but I haven't found any information on how to tell the script where the tool resides. What am I missing here?
_box
after the tool, but it still couldn't find it. How do you point arcpy at the toolbox? that's probably the easiest option? – David Grover Apr 7 '17 at 15:22