Set bone constraints via python API
Here is a quick example adding a copy rotation constraint to the active pose bone (in your case selected_bone), and giving it as a target the pose bone "Bone" from armature object "Armature.001" (target_bone).  Notice you use the bone's name for a subtarget.

import bpy
#context &amp; scene for testing
context = bpy.context
scene = context.scene

#active pose bone as example
bone = context.active_pose_bone
bone2 = None
# other armature other bone
arm2 = scene.objects.get("Armature.001")
if arm2 is not None:
    bone2 = arm2.pose.bones.get("Bone")
# give it a copy rotation constraint
if bone is not None:
    crc = bone.constraints.new('COPY_ROTATION')
    #give it a target bone
    crc.target = arm2
    # note subtarget uses name not object.
    crc.subtarget = bone2.name