I have a python script that should turn off all layers in a ArcGIS Pro project. But when I run it, the following error pops up:
File "<string>", line 2, in <module>
IndexError: list index out of range
Here is the python code I am using.
p = arcpy.mp.ArcGISProject("Current")
m = p.listMaps("Name of map")[0]
lyrList = m.listLayers()
for lyr in lyrList:
lyr.visible = False
Anyone know what I am doing wrong or missing?