Add the driver to the object, is data path is relative to that: # We want Object.pose.bones[...].constraints[...].rest_length # So use an object and the data_path 'pose.bones[...].constraints[...].rest_length' BaseLenghtDrv = bpy.data.objects[armature].driver_add('pose.bones["'+str(GrpName)+'_bone"].constraints["Stretch To"].rest_length').driver