Open map or layout window using arcpy

462
3
07-11-2023 07:33 PM
Status: Already Offered
Labels (1)
ToyotaT18
New Contributor III

Using arcpy in a Geoprocessing script, I can import a map or layout into the project. However I can't make it 'open' as a new window. It would be really good if this was possible.

3 Comments
JohannesLindner

Is this what you want?

aprx = arcpy.mp.ArcGISProject("current")

m = aprx.listMaps()[0]
m.openView()

l = aprx.listLayouts()[0]
l.openView()
ToyotaT18

Ah, I didn't realise those have been added! I had last looked when I had v2.8

That works well for a map window, yes.

However the layout option gives an error when run from an arcpy geoprocessing script? It works in the python window ok, just not from a gp script. Using v3.0.0

Thanks for pointing out the map option.

JeffBarrette
Status changed to: Already Offered

As pointed out by @JohannesLindner this is already available. Changing status to already offered.

Jeff - Layout and arcpy.mp teams