Running ArcGIS Pro 2.2, I have a layer in ~20 maps that needs it's name changed. I pulled this code together from a bunch of snippets, and have done my best to make sure it's updated appropriately, but I've hit a point where it runs without an error, but there are no changes afterwards.
What am I missing here?
import arcpy
aprx = arcpy.mp.ArcGISProject(r"C:\GIS_Local\Working.aprx")
for m in aprx.listMaps():
layers = m.listLayers()
for lyr in layers:
if lyr.name == "old name":
lyr.name = "new name"
There's a similar Q&A from a couple years ago - Use ArcPy to rename MXD layers, but I haven't been able to get the code there to update to Python 3.0 correctly, so I pulled this from the samples on the ESRI help and this GeoNet post