import bpy from bpy.app.handlers import persistent import shutil blender_bin = shutil.which("blender") if blender_bin: print("Found:", blender_bin) bpy.app.binary_path = blender_bin else: print("Unable to find blender!") @persistent def load_handler(dummy): print("Load Handler", bpy.data.filepath) bpy.app.handlers.load_post(load_handler)