AnsweredAssumed Answered

Can't list custom toolbox in ArcGIS Server's Python environment.

Question asked by jon.bailey on Jul 6, 2020
Latest reply on Jul 8, 2020 by jon.bailey

I've developed a custom toolbox that I'd like to run from a Python script. Using the ArcGIS Pro Python environment, I can load the toolbox and execute a tool from it:

 

    arcpy.ImportToolbox(os.path.join(script_path, "My Toolbox.tbx"))
    arcpy.MyTool_MyToolbox(a_workspace, b_workspace, output_workspace)

 

This works without a problem.


However, I can't guarantee that an ArcGIS Pro license will be available (the user might have signed out of arcgis.com). I can guarantee that an ArcGIS Server license will be available, so I think I should be able to run it from ArcGIS Server's Python environment.


In Visual Studio Code, if I switch to ArcGIS Server's Python environment (C:\Python27\ArcGISx6410.8\python.exe), I get the following error when trying to execute the tool:

 

    'module' object has no attribute 'MyTool_MyToolbox'

 

If I call arcpy.ListToolboxes(), the MyToolbox toolbox is one of the toolboxes returned. However, the MyTool tool is not returned by arcpy.ListTools().

 

I've verified that I can list the tool in ArcGIS Pro's Python environment.
 
ArcGIS Pro 2.5.1
ArcGIS Server 10.8

Outcomes