[QGIS-Developer] QGIS variables in Python code

Nyall Dawson nyall.dawson at gmail.com
Thu Nov 23 23:23:39 PST 2017


On 22 November 2017 at 21:21, Andreas Neumann <a.neumann at carto.net> wrote:
> Hi,
>
> Is it possible to query the value of a QGIS variable in Python code? E.g.
> I'd like to find out in my code the full storage path to the folder of my
> current QGIS project, which would be available in the @project_folder
> variable.
>

Yes, as Ismail said.

However, in this case it's easier to just use the PyQGIS QgsProject
API directly:

QgsProject.instance().fileName()

or

QgsProject.instance().homePath()

Nyall


More information about the QGIS-Developer mailing list