Get frame to frame object location Blender 2.81 + I have a script which generates a curve path and sets an object to follow the path, I can see the object moving correctly in the animation move, and it also moves to the correct location (at least visually in the view port, the coordinates when you press n do not change) when I use bpy.context.scene.frame_set(desirved_frame). However, when I try to get the location and rotation of that object at the frame that I set, it just returns the original location of the object at frame 0. Below is the code I have used to generate the animation data and what I'm using to try and get the location.
curve = bpy.data.objects[&quot;curve&quot;]
follower = bpy.data.objects[&quot;Follower&quot;]
con = follower.constraints[0]
con.target = curve
con.use_curve_follow = True

bpy.ops.object.select_all(action='DESELECT')
curve.data.use_path = True

path_length_m = curve.data.splines[0].calc_length()
time = path_length_m / car_v_mps
target_fps = 30
length = int(target_fps * time)
print(&quot;Frames is: &quot;, length)

anim = curve.data.animation_data_create()
anim.action = bpy.data.actions.new(&quot;%s-Action&quot; % curve.data.name)

fcu = anim.action.fcurves.new(&quot;eval_time&quot;)
mod = fcu.modifiers.new('GENERATOR')
mod.coefficients = (-frame_start / length * 100, frame_start / length / frame_start * 100)

def get_ext(scene, depsgraph):
    obj = scene.objects['Follower']
    obj = obj.evaluated_get(depsgraph)
    print(&quot;Frame: &quot;, scene.frame_current)
    print(&quot;Location: &quot;, obj.location)
        
scene = bpy.data.scenes[0] #This is the only scene, == bpy.context.scene

for frame in range(scene.frame_start, scene.frame_end):
    bpy.app.handlers.frame_change_post.append(get_ext)
    scene.frame_set(frame)
    bpy.app.handlers.frame_change_post.clear()
    

I have also tried replacing the final loop with:
for frame in range(scene.frame_start, scene.frame_end):
    scene.frame_set(frame)
    depsgraph = bpy.context.evaluated_depsgraph_get()
    ob = bpy.data.objects[&quot;Follower&quot;]
    ob = ob.evaluated_get(depsgraph)
    print(&quot;Location: &quot;, ob.location)
        

Both methods just print out the original location of the object.
Reading this documentation I'm not sure how I would use the examples they show to extract the evaluated location and rotation from the class they register, or how to even call the execute method.
Below are some solutions and answers I have read and attempted, with no success:
How do I get a mesh data-block with modifiers and shape keys applied in Blender 2.8?
Updating a 2.7 script that uses frame_current to work with 2.8+
Number of vertices and edges report no changes after adding boolean intersect modifier
Location of an object at a specific frame
Handler frame_change_pre doesn't work in render
Sun object not moving when Rendering Animation
I'm really not sure what I'm doing wrong as some of the questions I've looked at are quite similar to my issue.
Thank you for any help you can provide.
Object.matrix_world.to_translation()
Recommend using the matrix world,  of the evaluated object. Which is calculated for  each frame of blender. What you see in the UI, is the matrix basis.
Does a child object inherit the matrix from the parent?
Note the local matrix can be gained by multiplying the matrix world of an object, by its parents inverted matrix world. (link above shows how this relates to matrix basis, which is what we set via its components (rot, loc, scale) in the UI)
Here is a quick test script to output the global location of the cube, and evaluated cube for each frame.
There is no need to clear and add a handler for each frame.  Do make sure to clear handlers if running script multiple times as they will accumulate.
import bpy

names = (&quot;Cube&quot;,)
def frame_change_post(scene, dg):
    f = scene.frame_current
    for name in names:
        ob = dg.objects.get(name)
        if ob:
            print(&quot;dg&quot;, ob.name, ob.matrix_world.to_translation()[:])
        ob = scene.objects.get(name)
        if ob:
            print(&quot;scene:&quot;, ob.name, ob.matrix_world.to_translation()[:])
            
        
bpy.app.handlers.frame_change_post.clear()
bpy.app.handlers.frame_change_post.append(frame_change_post)

scene = bpy.context.scene
for f in range(scene.frame_start, scene.frame_end + 1):
    print(f&quot;frame {f} ------------------&quot;)
    scene.frame_set(f)
                

Output of running script.
Here I've run the script above directly from the text editor. The cube has an arbitrary follow path.  Note no difference here between result of un or evaluated object.
frame 1 ------------------
dg Cube (-0.4548962712287903, -7.230154037475586, 0.0)
scene: Cube (-0.4548962712287903, -7.230154037475586, 0.0)
frame 2 ------------------
dg Cube (-0.9097925424575806, -7.199532985687256, 0.0)
scene: Cube (-0.9097925424575806, -7.199532985687256, 0.0)
frame 3 ------------------
dg Cube (-1.357460618019104, -7.115467071533203, 0.0)
scene: Cube (-1.357460618019104, -7.115467071533203, 0.0)
frame 4 ------------------
dg Cube (-1.8044718503952026, -7.026542663574219, 0.0)
scene: Cube (-1.8044718503952026, -7.026542663574219, 0.0)
frame 5 ------------------
dg Cube (-2.238593101501465, -6.889674186706543, 0.0)
scene: Cube (-2.238593101501465, -6.889674186706543, 0.0)

Rendering animation.
dg Cube (-0.4548962712287903, -7.230154037475586, 0.0)
scene: Cube (-2.238593101501465, -6.889674186706543, 0.0)
Saved: '/tmp/0001.png'
 Time: 00:00.42 (Saving: 00:00.01)

dg Cube (-0.9097925424575806, -7.199532985687256, 0.0)
scene: Cube (-2.238593101501465, -6.889674186706543, 0.0)
Saved: '/tmp/0002.png'
 Time: 00:00.31 (Saving: 00:00.01)

dg Cube (-1.357460618019104, -7.115467071533203, 0.0)
scene: Cube (-0.9097925424575806, -7.199532985687256, 0.0)
Saved: '/tmp/0003.png'
 Time: 00:00.34 (Saving: 00:00.01)

dg Cube (-1.8044718503952026, -7.026542663574219, 0.0)
scene: Cube (-1.357460618019104, -7.115467071533203, 0.0)
Saved: '/tmp/0004.png'
 Time: 00:00.34 (Saving: 00:00.01)

dg Cube (-2.238593101501465, -6.889674186706543, 0.0)
scene: Cube (-1.8044718503952026, -7.026542663574219, 0.0)
Saved: '/tmp/0005.png'
 Time: 00:00.33 (Saving: 00:00.01)

dg Cube (-2.238593101501465, -6.889674186706543, 0.0)
scene: Cube (-2.238593101501465, -6.889674186706543, 0.0)