via startup.py it is possible to execute python code when qgis starts.
Now I wonder, whether it is possible to set variable values, eg. a string variable which holds a path or a dictionary of values, which could be used by several plugins?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.
Sign up to join this communityvia startup.py it is possible to execute python code when qgis starts.
Now I wonder, whether it is possible to set variable values, eg. a string variable which holds a path or a dictionary of values, which could be used by several plugins?
You have to get acces to an instance of that plugin:
from qgis.utils import plugins
instance = plugins['plugin_name']
Then if you want to use some widgets from main window ex.:
value = instance.dlg.comboBox.currentText()
If you define a variable under __init__
, you can use it with:
variable = instance.variable_name