Hello
I am working on a script and I am stuck at the stage of plotting the shapefiles from gdb's to an existing 2 different aprx files.
I need to run the code from Pyscripter not from the ArcGIS Pro directly as there will be 2 aprx files.
Thanks!
Solved! Go to Solution.
I didn't test this, but this is the general idea:
shapefile_path = r"C:\PATH\Shapefile.shp"
aprx_list = [r"C:\PATH\First.aprx", r"C:\PATH\Second.aprx"]
import arcpy
for aprx_path in aprx_list:
p = arcpy.mp.ArcGISProject(aprx_path)
m = p.listMaps()[0] # assumes data to be added to first map listed
m.addDataFromPath(shapefile_path)
p.save()
I didn't test this, but this is the general idea:
shapefile_path = r"C:\PATH\Shapefile.shp"
aprx_list = [r"C:\PATH\First.aprx", r"C:\PATH\Second.aprx"]
import arcpy
for aprx_path in aprx_list:
p = arcpy.mp.ArcGISProject(aprx_path)
m = p.listMaps()[0] # assumes data to be added to first map listed
m.addDataFromPath(shapefile_path)
p.save()
Thank you so much I just tried it and it worked!