Skip to main content
2 of 2
added 31 characters in body
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

You could try:

layer = qgis.utils.iface.activeLayer()? 

I do not know why you still need to use it in the latest QGIS.