trying to export mask animation but data dont change when changing frames! trying to export mask data i managed to do so for a single frame successfully by doing for each point:

bpy.data.masks[mask].layers[0].splines[0].points[0].co


then i change the frame by using to export mask coordinates animation:

bpy.context.scene.frame_current = i


when i do it from the console it works, but the problem is when i do it using a loop it does not update the data?

any help would be appreciated.
i found the solution is to use frame_set function:

bpy.context.scene.frame_set(i)