Evaluate FCurve without keyframes won't work i'm stuck here, i'm trying to evaluate a newly created FCurve to get the current value of associated property, and keep getting &quot;0&quot;. Here's an example working code with scale:
import bpy
# getting the object
obj = bpy.context.object
# the active object have action but no scale fcurve
# let's create it for x axis
fc = obj.animation_data.action.fcurves.new(&quot;scale&quot;, index=0)
# evaluate the current frame
value = fc.evaluate(bpy.context.scene.frame_current)
# print the result
print(&quot;value is %f&quot; % value)

This returns &quot;0&quot;, but the active object is &quot;1&quot; in x scale
(code can be run from console with selected object with action and no scale keyframe to test)
I don't really know how to get this &quot;1&quot; value programatically with object and data_path only.
The getattr() method could work, but i'm also using this code on pose bones, with these kinds of datapath : 'pose.bones[&quot;Bone&quot;].location[0]' and this doesn't seem to work with getattr()
Any clue out there ? thanks in advance guys ! cheers !
Get the object from the path.
Can get the object from the datapath via (with and without coercing to the value)
&gt;&gt;&gt; C.object.id_data.path_resolve('scale')
Vector((1.0, 1.0, 1.0))

&gt;&gt;&gt; C.object.id_data.path_resolve('scale', False)
bpy.data.objects['Vert.001'].scale

can look at the last part of the path and check whether that property is an array,
&gt;&gt;&gt; C.object.bl_rna.properties['scale'].is_array
True

however it is possibly easier to try and iter and if not use the index.
datapath = 'scale'
index = 0
frame = bpy.context.scene.frame_current

if not (len(fc.keyframe_points) or len(fc.sampled_points)):
    ob = obj.id_data.path_resolve('scale')
    try:
        iter(ob)
        value = ob[index]
    except TypeError:
        value = ob
else:
    value = fcurve.evaluate(frame)        

print(value)