execute_python
Run custom Python/arcpy code in a live ArcGIS Pro session to handle advanced map operations beyond standard tools. Return data by setting 'result' and capture output via print.
Instructions
Execute arbitrary Python/arcpy code inside the ArcGIS Pro bridge. Use this for complex arcpy.mp operations not covered by other tools.
Available variables: arcpy, os, proj (the ArcGISProject), get_map() Set result = in your code to return data. print() output is captured and returned as 'stdout'.
Example: code = """ m = proj.listMaps()[0] result = [lyr.name for lyr in m.listLayers()] """
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |