I have a script from List index out of range when put in startup.py on QGIS :
from qgis.core import *
layer = QgsVectorLayer('C:/Users/path_to_shapefile/vector_layer.shp', 'pl' , "ogr")
QgsMapLayerRegistry.instance().addMapLayer(layer)
vl = QgsMapLayerRegistry.instance().mapLayersByName('pl')[0]
iface.setActiveLayer(vl)
I want to put the script in startup.py. So when load QGIS, 'pl.shp' layer will be selected.
With this script, there is notification to save project or not. I have read to remove notification in Remove saving notification when use python QGIS at startup. Then I add the script in Remove saving notification when use python QGIS at startup. But, there is still notification. So, how to combine two script without saving notification?