I am reading a template project from PostGIS (without actually opening in in QGIS), then changing the project CRS (amongst other changes ) then saving it to a new destination. After that, I load the newly create project. For my surprise, the Project keeps opening with a wrong CRS.

project = QgsProject()
readflags = project.ReadFlags()
readflags |= QgsProject.ReadFlag.DontResolveLayers

project.read(project_uri, readflags)

# Replace Project CRS
if project_crs.isValid():


# Read and load the new project back
project = QgsProject().instance()

Now, the weird part. If I read the project twice, or open the project manually, the project loads with the correct CRS.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.