CopyParameter

Summary

Copies the specified parameter by index or parameter name to another parameter in the script tool. The specified parameters must be of the same data type.

Syntax

CopyParameter (from_param, to_param)
ParameterExplanationData Type
from_param

The index position of the parameter, or the name of the parameter to be copied.

Integer
to_param

The index position of the parameter, or the name of the parameter that will be copied to.

Integer

Code sample

CopyParameter example

Copy input parameter to output parameter using the parameter index positions.

import arcpy

# Copy the script tool's specified input parameter object
# to the script tool's specified output parameter.
arcpy.CopyParameter(0, 1)
CopyParameter example

Copy input parameter to output parameter using the parameter names. The script tool has two parameters, param_a, and param_b.

import arcpy

# Copy the script tool's specified input parameter object
# to the script tool's specified output parameter.
arcpy.CopyParameter("param_a", "param_b")

Related topics