Get Shape Key from Action or FCurve

I’ve been messing around with this for a while and I can’t seem to find the connection between fcurves and the specific shape key values they control.

I can use something like the following:
bpy.data.actions[‘KeyAction’].fcurves[0].data_path
to get:
‘key_blocks[“sitFix”].value’

But how do I get the shape key list that “sitFix” is in?
bpy.data.shape_keys[‘Key’].key_blocks[“sitFix”]
i.e. ‘Key’ in this instance

Searching by name doesn’t look like it will work, as Blender allows different shape key blocks to use the same name within different shape key lists, so there’s a ‘sitFix’ in both ‘Key’ and ‘Key.001’

Ultimately, I’m trying to see which mesh is being affected by a particular fcurve, but here I’ve hit a break in the chain connecting them.

Hi,

Added a Basis and two shape keys to the default cube.


>>> C.object.data.shape_keys.name
'Key'
>>> C.object.data.shape_keys.key_blocks['
                                         Basis']
                                         Key 1']
                                         Key 2']

I posted an answer at bse:

Thanks, I’ll follow up there.