execute_arcpy_code
Run Python code inside a live ArcGIS Pro session to perform geoprocessing, layer management, and queries when no dedicated tool fits the task.
Instructions
Run Python inside ArcGIS Pro. arcpy is already imported and arcpy.mp.ArcGISProject('CURRENT') is the open project. Variables persist between calls, print() output is captured, and the value of a final expression is returned. Use this whenever no dedicated tool covers the task.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Python source to run. | |
| reset_namespace | No | Forget variables kept from earlier calls. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |