Select to view content in your preferred language

How to import a Python script into ArcGIS

2243
2
Jump to solution
06-20-2013 06:03 PM
BrittanyGale
Frequent Contributor
Hello!

I created a python script tool that is going to be distributed online, and I want it to be able to be called from the ArcMap/Catalog python window (without having to include the function). If I drag the tool into the python window, "arcpy.ClipTIF(" appears, but when I try to execute the line of code with all of the appropriate attributes, I get this error:

Runtime error <type 'exceptions.AttributeError'>: 'module' object has no attribute 'ClipTIF'

FYI - "ClipTIF" is the name of my script tool and "clipTIF" is the name of my script's function. Neither work in the aforementioned line of code.

Question: How do I call the function from my python script tool in the ArcGIS python window?

Thank you in advance!

Brittany
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
JasonScheirer
Esri Alum
You'll need to call arcpy.ImportToolbox(r"c:\path\to\toolbox.tbx") before calling the tool.

View solution in original post

0 Kudos
2 Replies
JasonScheirer
Esri Alum
You'll need to call arcpy.ImportToolbox(r"c:\path\to\toolbox.tbx") before calling the tool.
0 Kudos
BrittanyGale
Frequent Contributor
Thank you so much!
0 Kudos