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 same rules that apply to models, such as the use of supported data types and the location of intermediate and output data, apply to script tools as well. The only difference is how you specify parameter properties. As illustrated below, parameter properties are modified in the properties page of the script tool. The illustrations show the common properties you will need to set.
Learn more about creating script tools.
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: