iface.activeLayer() intensively. Therefore, when I open QGIS, firstly I use the following script in QGIS Python Editor not to enter
from qgis.utils import iface L = iface.activeLayer() def activeLayerChanged(): L = iface.activeLayer() iface.currentLayerChanged.connect(activeLayerChanged)
I thought it would work if I added it to
startup.py file. I tried to add the script to
startup.py but I got error:
name 'L' is not defined.
How can I assing
L (or any single-letter variable) when starting QGIS, so that everytime I enter
L, I can get the active layer?
ais not found in QGIS