Retrieve updated value over frame change

Hi.
I’ve searched for similar subject for several hours, but sadly - no proper answer found. Maybe I’m not so good at searching stuff. In this case accept my apologies.
Anyway, I have following script here, which is trying to retrieve some animated property value over a number of frames


import bpy
C = bpy.context
D = bpy.data


C.scene.frame_current = C.scene.frame_start
while C.scene.frame_current <= C.scene.frame_end:
    bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)
    print(D.masks[0].layers[0].splines[0].points[0].co)
    C.scene.frame_current += 1

But even forcing redraw, which is not a good tone according to developer notes, does not giving a proper result. Every frame the value remains the same. Exactly what it was at a frame the script was executed on, to be specific.
A waaay back in a days i actually found a way to overcome this issue - creating a timer which puts script execution on hold, giving blender some time to redraw and update, but I still find this approach somehow clumsy, and I believe that there is a much more elegant way to solve this task.
Any ideas?

Scene.frame_set() is required:

import bpy
from bpy import context as C
from bpy import data as D

sce = C.scene
frame_current = sce.frame_current

for i in range(sce.frame_start, sce.frame_end + 1):
    # frame_set() is required to let Blender update animations etc.
    sce.frame_set(i)
    print(D.masks[0].layers[0].splines[0].points[0].co)

# reset to initial frame
sce.frame_set(frame_current)

Damn! Simple as this? :smiley:
I love you man!