You have to run qgis_prescript before executing the script

for exemple, make a .bat file with :


"""
call qgis_prescript.bat

python *exemple*.py

"""