HOW TO
A sublayer inherits the visibility of its group layer, hence, any attempt to enable the visibility of the sublayer does not work if the group layer is marked as invisible. The instructions provided describe how to display the desired sublayer in a set of group layers using Python when the visibility for the group layer is disabled.
The following is the script to disable the visibility of the parent group layers without affecting the visibility of the selected sublayer. Defining the parameter of the layer.longName method as the desired sub-layer retains the visibility of the selected sublayer.
import arcpy aprx = arcpy.mp.ArcGISProject("Current") m = aprx.listMaps("Map")[0] layers = m.listLayers('Layers') for layer in layers: layer.visible = True if layer.longName == "Group Name\SubLayer Name": layer.visible = True
Get help from ArcGIS experts
Download the Esri Support App