I have a problem with the mode after reopening a blender file (using Blender 2.74.2). When I run the following code:
import bpy
scn = bpy.context.scene
bpy.ops.mesh.primitive_plane_add(location=(0.0, 0.0, 10.0))
bpy.ops.transform.resize(value=(12.5, 12.5, 1.0))
# Delete the object
bpy.ops.object.delete()
# Close the scene and reopen it.
bpy.ops.wm.save_mainfile(filepath="/home/ma/Desktop/tempdelete.blend")
bpy.ops.wm.open_mainfile(filepath="/home/ma/Desktop/tempdelete.blend")
bpy.ops.mesh.primitive_plane_add(location=(0.0, 0.0, 0.0))
bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.transform.resize(value=(12.5, 12.5, 1.0))
the script gives an error message and the 3D view is in a strange kind of mode, it displays "object" mode but behaves like "edit" mode. (see picture)
Can anyone help me to figure out what the problem is? I would like to work (with python) on the added plane.
bpy.ops.wm.save_as_mainfile(filepath=filepath)– batFINGER May 17 '16 at 18:05