I'm writing a little picker for Blender. The principle of operation is simple. I select some armatures, go into pose mode. If I select bones, then bones with the same name in other armatures become selected.

import bpy

def picker(scene):
    selected_obj = [obj.name for obj in bpy.context.selected_objects]
    selected_arm = (bpy.data.armatures[selected_obj])
    selected_bones = [bone.name for bone in bpy.context.selected_pose_bones]
    for bone in selected_arm.bones:
        if bone.name in selected_bones:
            bone.select = True            

The script works if you specify the name of the armature, for example:

selected_arm = bpy.data.armatures['Armature.001']

But I don't know how to make it work for any number of armatures with any names.


2 Answers 2


I think this script should do what you want.

import bpy

armatures = [o for o in bpy.context.scene.objects if o.type == "ARMATURE"]
# If you want to select only from selected armatures, use the next line instead.
# armatures = [o for o in bpy.context.selected_objects if o.type == "ARMATURE"]
selected_bones = bpy.context.selected_pose_bones

for armature in armatures:
    for selected_bone in selected_bones:
        bone = armature.pose.bones.get(selected_bone.name)
        if bone:
            bone.bone.select = True
  • $\begingroup$ Thanks a lot! That's what I need! $\endgroup$
    – AlexFrozd
    Commented Jun 1, 2021 at 10:01

I would iterate through all selected objects and check if their o.data was of type armature. Then, if it was, run the bone matching loop on it.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .