import bpy # save blend bpy.ops.wm.save_mainfile() # save as bpy.ops.wm.save_as_mainfile(filepath=filepath)