Creating script tools for geoprocessing tasks
A script tool is equivalent to a model tool. Instead of using the ModelBuilder visual programming language to implement your tool, you use a text-based programming language. Python is the preferred text-based programming language for geoprocessing.
All the rules that apply to models, such as using supported data types and locations of intermediate and output data, apply to script tools as well. The only difference is how you specify parameter properties. Script tool parameter properties are modified on the properties page of the script tool. The illustrations show the common properties you will need to set.
In addition to setting the properties of input parameters, you need to ensure that your scripts are writing intermediate or scratch data to the scratch workspace. In a Python script, you access the scratch workspace as follows:
scratchWS = arcpy.env.scratchWorkspace