from qgis.core import QgsProject project = QgsProject.instance() project.setFileName('new_project.qgs') project.write()
from qgis.core import QgsProject project = QgsProject.instance() project.read('existing_project.qgs')
from qgis.core import QgsProject project = QgsProject.instance() project.close()This code example shows how to close the current project. Package Library: The package library used in these code examples is `qgis.core`.