Blender Version
Broken: Blender 2.81a
Short description of error
In the quick start document inside the API reference
https://docs.blender.org/api/current/info_quickstart.html
we can read
"But bpy.context.scene.objects.active = obj will work as expected."
This is not true in Blender 2.81a.
Possible fix
One way of selecting objects from the API using bpy.context in Blender 2.81a is as follows
cube = bpy.data.objects["Cube"] cube.select_set( state = True, view_layer = bpy.context.view_layer ) bpy.context.view_layer.objects.active = cube