Hi, I'm making the transition from ArcMap to ArcGIS Pro so please forgive my ignorance...
At the start of my Arcpy script, I am trying to delete all of my layers in my layout except 'Coast'. When I run my script below it crashes ArcGIS Pro. Any advice graciously accepted.
aprx = arcpy.mp.ArcGISProject("CURRENT")
mp = aprx.listMaps("Map")[0]
keeplyr = mp.listLayers("Coast")
for rmlyr in mp.listLayers():
if rmlyr != keeplyr:
mp.removeLayer(rmlyr)