I have a bit of a problem with a python script tool that I am trying to get to work when I chain it to other tools in a model made in model builder. It's just a simple dummy tool I set up to try to sort things out, the model selects a polygon, based on user input via a point type feature set, and buffers this selected polygon (this is the script part) then I wanted to copy the result output (featureclass) to another location by chaining the script tool to the copy features tool but no matter what I try it gives me an error that an input value is required (see model diagram, script tool parameter settings and script tool code below). Script tool runs fine on it's own by the way and gives proper results.
Mybuffers Script tool code:
from arcpy import env
#Set environement variables
scratch = env.scratchGDB
env.overwriteOutput = True
arcpy.SetLogHistory(False) #Important to reduce metadata writing
#Get input parameters
inpnt = arcpy.GetParameterAsText(0)
mypolys = arcpy.GetParameterAsText(1)
outfcname = os.path.join(scratch, "mybuffers")
#Make feature layer from input point(s)
inpntlyrname = "InputPoints"
inpntlyr = arcpy.MakeFeatureLayer_management(inpnt, inpntlyrname)
#Make feature layer from polygons
polylyrname = "MyPolygons"
polylyr = arcpy.MakeFeatureLayer_management(mypolys, polylyrname)
#Select polygons that intersect input points
selpolys = arcpy.SelectLayerByLocation_management(polylyr, "INTERSECT",
inpntlyr, "25 Meters", "NEW_SELECTION")
#Buffer selected polygons
arcpy.Buffer_analysis(selpolys, outfcname, "5000 Meters")
#Set output parameter
outputfc = arcpy.SetParameterAsText(2, outfcname)
Mybuffers script tool parameters settings (for the output parameter):
It's like the copy features tool is not getting the data from the script tool even though I've used countless different versions of the SetParameterAsText() and read as much as I can take of the official help. Perhaps there is some good hearted soul willing to look over my code to help me see where I'm going wrong because I'm stuck and getting really annoyed at this
I've been relying on the official help in the link below, chapter heading "Derived output that does not modify an input parameter". I have now tested setting up exactly the same example with the post data to repository script tool and the copy features section of the model fails in the exact same way i.e. "input value required", the second tool in the chain does not run.