How do I change this Rigify parameter in Python?

I’m trying to change this Rigify parameter in Python:

  • Bone Tab -> Rigify Type -> Bend Rotation Axis

Unfortunately, the output of the Info window isn’t shedding much light on how to call it:

I have tried this…

 bpy.data.objects['metarig'].pose.bones['thumb.01.L'].primary_rotation_axis = 'X'

…but I’m getting this error:

 AttributeError: 'PoseBone' object has no attribute 'primary_rotation_axis'

When I hover over the Bend rotation axis dropdown, I get the following tooltip:

image

It appears that I need to access the RigifyParameters class from within the Rigify add-on, but…how?

Never mind – figured it out!

 bpy.data.objects['metarig'].pose.bones['thumb.01.L'].rigify_parameters.roll_alignment = 'manual'
 bpy.data.objects['metarig'].pose.bones['thumb.01.L'].rigify_parameters.copy_rotation_axes = [True, False, False]