I'm running my code in the linux console and there are always problems when using the iface function. I wanted to know if it is possible to define the active layer without using the iface function. Currently my code looks likes this:
qgis.utils.iface.setActiveLayer(rlayer)
rlayer = iface.activeLayer()
Is there another way to write this and get the same results?