accessing and editing drivers

Im trying to access driver information on a bone.

Unfortunately the drivers belongs to the armature like so:

bpy.data.objects['Armature.Rusty'].animation_data.drivers[int]

where int is the id of the driver. As i have tonnes of drivers is there a way to access the driver from the bones perspective? if that makes sense.

could be something like

bpy.data.objects['Armature.Rusty'].animation_data.drivers.find['key from bones data']

or come from the bone’s data side…though i dont see any way to :(:

bpy.context.selected_pose_bones[0]......

What is sometimes annoying is when you hover the mouse over a property in blender and it has such a long data path it puts a ‘…’ in place of the crucial information :stuck_out_tongue:

you could loop over all drivers and check the data_path to filter out only those referencing a certain bone:

for driver in bpy.data.objects['Armature.Rusty'].animation_data.drivers:
    if driver.data_path.startswith('pose.bones["%s"]' % "Bone.001"):
        # ...