esther.fernandezesri-es-esridist

Calling a custom script tool within a loop

Discussion created by esther.fernandezesri-es-esridist Employee on Mar 10, 2011
Latest reply on Sep 22, 2011 by stacyrendall
Hi everybody!

I'm having an issue calling a custom tool (python code) from another script tool. I need to loop through a bunch of folders and execute the custom tool for each one of them. If I call a model tool (from the same toolbox) inside the loop everything works fine but If I call the custom script tool it seems arcpy is not able to find the tool. The script tool calls to other custom modules.
I get the following error:

<type 'exceptions.AttributeError'>: Object: Tool or environment <s> not found

If I try a second execution the error is slightly different:

<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'LectorASC_AdmLocal'

'AdmLocal' is the alias of my toolbox and 'LectorASC' the name of my python tool. This is the call I'm doing inside the loop:

arcpy.LectorASC_AdmLocal(DXFPolyline,subpar)

The weird thing is the first call in the loop works fine but the second throw the exception.

Any idea?

Thanks in advanced

Esther

Outcomes