Hello,
I have the following procedure which turns layers on or off on a mapview. But I find that the changes only apply if I save the project but I find saving the project adds alot of time onto the execution of the script. Is there something different I can do, possibly some way that will just update the mapview where the layers have been turned on/off?
Thanks!
def SetLayers(prj, mapName, lyrs, status):
aprx = arcpy.mp.ArcGISProject(prj)
m = aprx.listMaps(mapName)[0]
for lyr in m.listLayers():
if lyr.name.upper() in lyrs:
if status == 'on':
lyr.visible = True
else:
lyr.visible = False
aprx.save()
del aprx