Page MenuHome

API reference : `bpy.context.scene.objects.active = obj` is no longer possible
Confirmed, NormalPublic

Description

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

Event Timeline

Robert Guetzkow (rjg) changed the task status from Needs Triage to Confirmed.Fri, Jan 3, 6:43 PM
Robert Guetzkow (rjg) edited projects, added Documentation; removed BF Blender.