How do I rename a group layer in ArcGIS Pro using ArcPy?
In ArcMap I can do so thus:
groupLayer = arcpy.mapping.Layer(r"Path to grouplayer.lyr")# empty group layer as template
groupLayer.name = some string
arcpy.mapping.AddLayer(dataframe, groupLayer, add_position='TOP')
I can't find an analogous way to do this in ArcGIS Pro:
glyr = arcpy.mp.LayerFile(r"Path to GroupLayer.lyrx")# empty group layer as template
glyr.name = some string
theMap.addLayer(glyr, add_position='TOP')
While the above code adds the group layer, it does not rename it, and it does not flag an error so I'm not really sure what is going on.
