How do you get the Euler angle between 2 objects?

Hi,
I am working on getting the rotation between 2 spheres in a 3D scene. The z for both spheres are the same so we can assume these 2 spheres are in a 2d space with only x and y.
The question is, how do I get the Euler angle between the 2 spheres, so I can place another object, cylinder to connect these 2 spheres?
The current attempt is the following.

private void angleBetween(Transform part1, Transform part2) {
        Debug.Log(part1.position);
        Debug.Log(part2.position);
        Debug.Log(part1.position - part2.position);

        Vector3 angle = part1.position - part2.position;
        Debug.Log(Mathf.Atan(angle[1]/angle[0]));
}

If you have any other suggestions, let me know! Thanks in advance

The angles depend on the transform’s rotations.

Debug.Log(Quaternion.Angle(part1.rotation, part2.rotation)