AnsweredAssumed Answered

Turn Layers off In ArcGIS Pro using Arcpy

Question asked by bisoftware on Nov 20, 2017
Latest reply on Nov 20, 2017 by pcrosier

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?

Outcomes