For anyone else that stumbles across this question, I managed to solve the issue using a batch file with the following code: cd C:\Program Files\QGIS 3.4\bin qgis --project "path to .qgz project file" --code "path to .py python code file" The `qgis` bit in the second line needs to match whatever .bat file is run to open QGIS. For some users this was qgis-ltr. This launches QGIS and opens a saved project, then runs the python script. And my python script needed to start with the following to execute properly: from qgis.core import * import qgis.utils from qgis.utils import iface