Get Currently Selected Layer in ArcMap Table of Contents

Discussion created by mangoldd on Feb 12, 2014
Latest reply on Feb 12, 2014 by johnmdye
I am developing a Python plugin that needs to get information about the currently selected layer in the ArcMap table of contents. I've looked through the arcpy.mapping module for an appropriate function and searched the internet but to no avail. Is there a way to get the name (or index) of the currently selected layer using arcpy? With either piece of information, I could then use arcpy.mapping.ListLayers() to get the appropriate layer object. In the sample below, I would like the python script to get either u'Nodes' (name) or 0 (index) from the selected layer.


Thanks for your help,


ArcGIS 10.1 SP1