Is it possible with a Python script to select the curve of an object with its name ("location x", "location y", "rotation z", ....) instead of its number.

For example, I tweak the Z location of an object with

bpy.data.objects["Pixel X0006 Y0006"].animation_data.action.fcurves[2].keyframe_points[0].interpolation = 'LINEAR'

and I would like to select it by a name rather than with fcurves[2]. It would be more convenient for my scripts.

Is it possible to do that ?

  • $\begingroup$ Try printing the name of the curve. Try to [find] the curve by name. I will check to see where this function is. You may be faster than I am. $\endgroup$ Commented Mar 12, 2020 at 16:48

1 Answer 1


Yes its possible.

This is an excerpt from an older, non latest version of Blender script. The relevant part may still work. Note the find function. You can see the name of the curve in the FCurves Editor Panel. Note curves may have an index X in the set [0,1,2].

object_bq = bpy.data.objects[name]
test = object_bq.animation_data.action if (None != object_bq.animation_data and (None != object_bq.animation_data.action)) else None;
if (test):
    fc = object_bq.animation_data.action.fcurves.find("Some Curve Name Visible in the FCurves Editor Panel");




You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .