I want to know how to get features from a layer on click event.. using python(m trying to create a plugin).. the below code always show 0 output
layer = iface.activeLayer()
selection = layer.selectedFeatures()
print len(selection)
for feature in selection: print feature['NAME']
layer = iface.activeLayer()
selection = layer.selectedFeatures()
print len(selection)
for feature in selection:
print feature['NAME']