I have 2 different hand objects in separate files that have bones identically named. I want to set the angles between the bones of hand 2 same as the angles in hand 1 so that they have the same posture.

I have tried getting the bones' positions from hand 1 as normalized vectors, then do the same for hand 2 and find the angles between two vectors along X, Y and Z axes. Then, rotate the bones with those angles. However, the result is not at all what I want. The rotate\_euler.rotate\_axis() function rotates the bone over its local axes, not the global ones.

How should I approach this problem? Any help would be appreciated.

Here are some screenshots for better visualizing the situation.

**Bone 1**

[![enter image description here][1]][1]

**Bone 2**

[![enter image description here][2]][2]

**Script that saves normalized vectors from Bone 1**

```
import bpy
import json
from math import *
from mathutils import *
import numpy as np

obj = bpy.data.objects["Armature"]
bones = obj.pose.bones

with open("vectors.json","w") as outfile:
    outfile.write("[")
    i = 0
    for bone in bones:
        u = (bone.tail - bone.head).normalized()
        outfile.write(json.dumps({bone.name:list(u)},indent = 2))
        if(i != len(bones.keys())-1):
            outfile.write(",\n")
            i += 1
    outfile.write("]")

```

**Script that finds the angles and rotates the bones of Hand 2**

```
import json
import numpy as np
import bpy
from math import *
from mathutils import *

arm = bpy.data.objects["Armature"]

with open("vectors.json","r") as infile:
    vectors = json.loads(infile.read())

counter = 1
for vector in vectors:
    v1 = vector
    key = list(v1.keys())[0]
    print(key)
    v1 = Vector(vector[key])
    bone = arm.pose.bones[key]
    v2 = bone.tail - bone.head
    v2 = v2.normalized()

    angleyz = acos(np.dot(v1.yz,v2.yz))
    anglexy = acos(np.dot(v1.xy,v2.xy))
    anglexz = acos(np.dot(v1.xz,v2.xz))

    bone.rotation_mode = 'XYZ'

    bone.rotation_euler.rotate_axis("X", angleyz)
    bone.rotation_euler.rotate_axis("Y", anglexz) 
    bone.rotation_euler.rotate_axis("Z", anglexy)

```

**Result**
[![enter image description here][3]][3]

**The Files I am working on**

<https://drive.google.com/drive/folders/1d4J1O7GuPSU6UeEd-YdZ0M4EN0be1p9v?usp=sharing>

I am trying to make the hand in the abnormal.blend to have the same pose as the hand in neutral.blend
[1]: <https://i.stack.imgur.com/BxpqC.png>
[2]: <https://i.stack.imgur.com/Q0ctQ.png>
[3]: <https://i.stack.imgur.com/G4yjy.png>