I am using python in ArcPro and relearning a few things.
I have a feature selected in the dataframe. I want to determine the name of that layer that has a selection and return the value of the selected object in the field called "GNIS_Name" .
aprx <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>mp<SPAN class="punctuation token">.</SPAN>ArcGISProject<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"CURRENT"</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#get selected layer </SPAN>
m <SPAN class="operator token">=</SPAN> aprx<SPAN class="punctuation token">.</SPAN>listMaps<SPAN class="punctuation token">(</SPAN>aprx<SPAN class="punctuation token">)</SPAN>
refLyr <SPAN class="operator token">=</SPAN> m<SPAN class="punctuation token">.</SPAN>listLayers<SPAN class="punctuation token">(</SPAN>aprx<SPAN class="punctuation token">)</SPAN>
sel_lyrs <SPAN class="operator token">=</SPAN> refLyr<SPAN class="punctuation token">.</SPAN>getSelectionSet<SPAN class="punctuation token">(</SPAN>aprx<SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token"># get name of selected stream </SPAN>
Stream_Name <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>SearchCursor<SPAN class="punctuation token">(</SPAN>sel_lyrs<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"GNIS_Name"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"Any value"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">""</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
currently I get the error on line 5: 'list' object has no attribute 'listLayers'