For example, I have a custom tool "wellTabletoFC". When I pull up the Item Description, it gives me a syntax as if it can be used within the console:
wellTabletoFC(Input_Table)
When I drag the script into the Python window, I get this code:
>>> arcpy.wellTabletoFC()
Runtime error
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute 'wellTabletoFC'
How do I use my own tools in the same way as ArcGIS tools within ArcPy, for example:
arcpy.Project_management(
in_dataset,
out_dataset,
out_coor_system,
transform_method,
{in_coor_system},
{preserve_shape},
{max_deviation},
{vertical}
)
I want to do this for 2 reasons:
Solved! Go to Solution.
If it's a script tool in a toolbox, you can import the toolbox and script tool:
Adding toolboxes in Python—Geoprocessing and Python | ArcGIS Desktop
is it a script? (aka module) in a location that is within your import path?
import wellTabletoFC
If it's a script tool in a toolbox, you can import the toolbox and script tool:
Adding toolboxes in Python—Geoprocessing and Python | ArcGIS Desktop
Just what I was looking for, works perfectly! Thank you
This doesn't seem to persist after ArcMap is closed; is this something that only works during that session?
Yes, every time you run your script you need to import the toolbox, much like you need to import any modules at runtime as well.
That makes sense, thank you