0

I have a Python script that takes several input parameters, one of which is the name of an output folder which will hold processed data (outFolder). I want to be able to access that outFolder variable displayed as an output (outFolder--> Process-->outFolder) as well once the process has finished and "outputted" the results into the outFolder. Basically, I want to use that same filled outFolder as an input for another process in ModelBuilder. How do I do this?

#Get the input feature class, optional fields and the output filename
input_FC = sys.argv[1]
inField = sys.argv[2]
theFName = sys.argv[3]
outFolder = sys.argv[4]

enter image description here

enter image description here

  • 2
    Use arcpy.setParameterAsText and set it equal to your input variable. Then add a parameter to your script tool. Make it an output or derived type. It will then let you connect as long as the data type is compatible with the next tool input type – Ben S Nadler Mar 9 '18 at 15:47
  • What should I use in the "text" parameter for arcpy.SetParameterAsText(index, text)? – gwydion93 Mar 22 '18 at 14:24
  • OK, this worked. I removed all of the sys.argv methods on my main parameters and used arcpy.GetParameterAsText instead. Using both methods in the same script created too much confusion in the indexing. Once I started with an index of (0) and added outFolder as my "text" parameter. everything worked. – gwydion93 Mar 22 '18 at 19:22
1

Use arcpy.setParameterAsText and set the outval equal to your input variable. Then add a parameter to your script tool. Make it an output or derived type.

The index # of the output parameter in the script tool is what you enter in the arcpy.setParameterAsText(#,outval)

It will then let you connect as long as the data type is compatible with the next tool input type

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.