1

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?

  • Hi, i think there must be several ways to achieve that ... if u're using Windows u can work with environnement variables that can be set and accessed by your python code ... – snaileater Aug 24 '15 at 8:42
3

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.