Obtain Index of Layer Within a Group Layer in Python

Discussion created by mvolz47 on Feb 14, 2012
Latest reply on Feb 14, 2012 by mvolz47
To All ArcGIS Python Users:

I would like to create a python script where I can remove a layer from an mxd and replace it with a new layer that is placed in the exact same location.  It is essential that this script would be able to replace the layer in a Group Layer as this is how it exists in hundreds of mxds.  I had a VBA script that performed this type of task, but it did not work with Group Layers as I was unable to get the layer index within the Group Layer.  As such I had to perform the Group Layer individual layer replacement manually which was quite time consuming.  Does python give you the ability to obtain the index of a specific layer within a Group Layer?  Any help or hints regarding this topic are greatly appreciated.  Thank you.