BrokenLegMike

Pulling Feature Layer from Group Layer and apply Symbology?

Discussion created by BrokenLegMike on May 15, 2014
Latest reply on May 15, 2014 by rfairhur24
I'm trying to use the symbology from a layer file, to apply to a layer in my map via python. My layer file is a group layer file. The layer in the map is not a grouped layer file. When I do this:

for lyr in arcpy.mapping.ListLayers(mxd,"",df):
     Layer = arcpy.mapping.Layer(path_to_LayerFile)
     arcpy.ApplySymbologyFromLayer_management (lyr, Layer)


It will crash beause the 'Layer' is a group layer, where lyr is not.

I flipped through the arcpy.mapping.Layer helpfile here and I can see that I can test for isGroupLayer or isFeatureLayer, but I'm not sure how I would go about grabbing the underlying feature layer from the group layer and apply the symbology to lyr in my example about? More specifically, I don't suppose there is a directory path for feature layers inside of a group layer (i.e. G:\layers\Test_Grid_Group.lyr\Unit) <---That doesn't work, but I'm looking for something like that....

Outcomes