Hello - We are using ArcGIS 10 and Python 2.6. I have a Python script tool where I would like to call a custom-built tool. In my tool script I import my toolbox if it has not already been imported (I check the arcpy.ListToolboxes()).
if "AddLayerToolbox" not in arcpy.ListToolboxes():
arcpy.ImportToolbox([path to toolbox])
I then make the following call as debug:
arcpy.AddMessage(inspect.getargspec(arcpy.AddLayerToMXD_jtools))
That prints out the arguments to that tool correctly so I assume that arcpy knows about that tool now. Then I call the tool via:
arcpy.AddLayerToMXD_jtools(param1, param2)
With that call, I get the error:
Error: 'NoneType' object has no attribute 'AddLayerToMXD_jtools'
I am not sure what this really means since. It isn't an issue with the parameter values because that would come back with a different error. This is indicating that it can't find that tool, although I used that tool in the preceding call to print out the tool's arguments. I tried running a test where I used one of the standard ArcGIS Toolbox methods and that seemed to run fie.
Any thoughts on what I am missing?
Thanks - Peter