1

I am trying to open an empty project using PyQGIS, i.e. doing this:

enter image description here

All the answers I can find relate to already existing projects. i.e. they load a file like this:

project = QgsProject.instance()
project.read('file.qgs')

I've tried passing no parameters/empty string to the read method, but with no effect. Looking at the methods that QgsProject.instance() provides, it doesn't seem like there is another method that would do this either.

3

You only need this,

iface.newProject()

https://www.qgis.org/api/classQgisInterface.html#a556cb94a2fcb3b21004c405b847d32d1

1
  • 2
    The reason I could not find any answers is because no one asked it because it is too simple! Good to know that the iface makes this possible :-) May 4 '20 at 8:34

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.