According to Blender 2.8 Python API changes mesh (object) can be selected with using getters and setters.
When trying to check the selected status of the mesh through the “bpy.context.active_object.select” property, Blender throws an error:
AttributeError: ‘Object’ object has no attribute ‘select’
To check whether an object is selected in Blender 2.8 use a getter:
1 2 |
bpy.context.active_object.select_get() # True |
To select an object in Blender 2.8 use a setter:
1 |
bpy.context.active_object.select_set(state=True) |
To unselect an object use the same setter:
1 |
bpy.context.active_object.select_set(state=False) |