How to make a bone active? I am trying to select a bone and make it active in 2.80, so I can run an operation on it (connect it to its parent), the bone gets selected, but does not get active, as shown in the picture, when active, the name of the bone appears in the interface, anyone has an idea what might be the problem here?



Here is the code I use…

bone.select = True;
bone.select_head = True;
bone.select_tail = True;
bpy.ops.armature.parent_set(type=‘CONNECTED’)


Thanks in advance
Gilles
API properties.

Set the active bone with arm.edit_bones.active = bone.  However propose there is no need to use the parenting operator, can rather set the properties, parent, use_connect

Python console code with armature arm in edit mode.

&gt;&gt;&gt; arm
bpy.data.armatures['Armature']

&gt;&gt;&gt; bone = arm.edit_bones["Bone"]
&gt;&gt;&gt; bone2 = arm.edit_bones["Bone.001"]
&gt;&gt;&gt; # active edit bone
&gt;&gt;&gt; C.active_bone.name
'Bone.001'
# set active edit bone
&gt;&gt;&gt; arm.edit_bones.active = bone
&gt;&gt;&gt; C.active_bone.name
'Bone'
&gt;&gt;&gt; bone2.parent = bone
&gt;&gt;&gt; bone2.parent.name
'Bone'
# check if connected.. nope
&gt;&gt;&gt; bone2.use_connect
False
# connect
&gt;&gt;&gt; # connect the bone
&gt;&gt;&gt; bone2.use_connect = True
&gt;&gt;&gt;