Is there any way to detect if a script is computed on QGIS python console or not?
Any attribute or test to assess it?
Is there any way to detect if a script is computed on QGIS python console or not?
Any attribute or test to assess it?
You sure can.
import qgis.utils
inqgis = qgis.utils.iface is not None
In QGIS this will return True outside it will return False
I didn't check, try this:
A) from qgis.utils import iface
B) iface.mainWindow() == None
giev us a feedbak