0

In ArcGIS 10.5, I have the following script which grabs the files from a geodatabase and merges them into one layer:

import arcpy


# specify the path to the GDB with the asset files
#make sure the path uses '/' and NOT '\'
arcpy.env.workspace = 'path/example.gdb'
arcpy.env.overwriteOutput = True


# collects all the Feature Classes in the GDB
fcs = arcpy.ListFeatureClasses()

# run the Merge tool
arcpy.Merge_management (inputs=fcs, output='merge_result')

I added the script to my toolbox as 'Merge'. I then go on to add the script to my model, where I need to use the 'merge_result' output for other processes. However, when I add the script to the model, there is not 'output nodule' which I can connect to the other processes (such as Intersect, seen below). How would I go about adding an output nodule to this?

enter image description here

2

To specify the output you'll want to use either arcpy.SetParameter() or arcpy.SetParameterAsText() depending if you want to output an object or return text.

I am guessing you want to use the filename of your merged feature class so I would add the following line to the end of your script:

arcpy.SetParameterAsText(1, 'merge_result')

Also, check this answer: Adding output parameter to Python script tool?

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.