I'm trying to use python to assign properties to a label class to a layer in my map in ArcGIS Pro 2.2.1, and no matter what I do, the changed properties do not appear when I examine the Label Class in the map. Below is an example of my code:
import arcpy
aprx = arcpy.mp.ArcGISProject(r"C:\Users\maxwell.reis\Desktop\USACE\Working_Map\Working_Map.aprx")
m = aprx.listMaps("Map")[0]
lyr = m.listLayers("TEMP_lyr")[0]
print(lyr.listLabelClasses("Class 1")[0].expression)
lblClass = lyr.listLabelClasses("Class 1")[0]
lblClass.expression = "$feature.PARNAME"
print(lyr.listLabelClasses("Class 1")[0].expression)
aprx.save()
The first print line correctly displays the label class expression of the layer in the map, and the second print line shows that the expression has successfully changed. However, when I go into the map to view the label class properties, nothing has changed.
Am I missing a step in the process? Is there another statement I need to make in python to get the map to recognize the updated Label Class Properties?