arcpy doesn't see a tool that I have loaded

189
4
07-11-2019 09:33 AM
RandyMcGregor2
Regular Contributor

I have made a custom tool that I want to use in another custom tool. I have loaded the toolbox that it is in using arcpy.ImportToolbox. 

I keep getting the following error:

The error occurs at "arcpy.AddPivotField_tsa_tools"...

This tool really does exist. I listed the tools from this toolbox within the script and it correctly listed this tool, including the alias "_tsa_tools" It seems to have access to this tool.

Most obvious explanation is that I am entering it wrong, but I'm not. I've tried many many times.

I have a feeling this is a facepalm. I'm overlooking something obvious. Is there something that needs to be done to "tell" arcpy that this tool exists?

Thank you for any assistance you may be able to provide.

0 Kudos
4 Replies
RachelSears
Occasional Contributor II

Hi Randy,

Try removing the underscores from the toolbox alias.

Let me know if this helps! 

0 Kudos
RandyMcGregor2
Regular Contributor

Thanks! I will try that.

0 Kudos
LingtaoXie
Esri Contributor

Hello Randy,

A custom tool typically has a name and a label --

The Name property is the language-independent name of the toolbox and is used as a language-independent reference to a tool within a toolbox in scripting.
The Label property is language dependent, so if you give your toolbox to someone who uses a different language (or just doesn't like the label), he or she can change just the label without breaking any script references to the toolbox.

Could you check the properties of your custom tool to confirm if "AddPivotField_tsa_tools" is the name or the label? We would need to call the tool by its name in ArcPy.

Let me know how it goes

RandyMcGregor2
Regular Contributor

Thanks,

I am using the model name, not the label. The problem, may be the underbars in the alias. I'll try that.

Thank you for your input.

Randy

0 Kudos