Now it's possible in QGIS 2.12 to add your own variables, I wonder how I can add new variables or change variables using the Python console.


Use the QgsExpressionContextUtils class (see http://qgis.org/api/classQgsExpressionContextUtils.html). It has method for adding variables to different scopes, eg global, project, layers, etc.

|improve this answer|||||

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.