Finding vertex locations at a given frame using python I have an issue where I can’t find the current location of a cubes’ global vertex location.  The cube is moved and key framed through code, but when I try to find the location (of any vertex) at each subsequent frame, it always returns the location of the cubes’ vertex at the start frame. Follow these steps to replicate the error:

Create a cube called Cube.001



import bpy
import random
Scene_Name = bpy.context.scene.name

def Move(Name):
    bpy.context.object.location[0] = bpy.context.object.location[0] + 2  

def MovingVertex(): 
    C = bpy.context
    aObj = C.active_object

    if aObj == None:
        print('No Mesh seleted')
        return
    vts = aObj.data.vertices
    for count in range(0, 8):
        x = [i.index for i in vts if i.select==True][3]
        if x == None:
            print('1 Vertex selected at least')
            return
        wm = aObj.matrix_world.copy()
        aP = wm * vts[x].co

    print(bpy.context.scene.frame_current)
    print(aP) 

for frame in range(1, 100):
    bpy.data.scenes[Scene_Name].frame_current = (bpy.data.scenes[Scene_Name].frame_current + 1)
    for Count in  range(1, 2):
        Name = "Cube." + str(format(Count, '03'))
        ob = bpy.data.objects[Name]
        bpy.context.scene.objects.active=ob
        Move(Name)
        MovingVertex()
        cf = bpy.data.scenes[Scene_Name].frame_current
        ob.keyframe_insert(data_path='location', frame=(cf))


Output of frame number and cubes’ vertex location:

1682
&lt;Vector (3168.8081, -1.3707, -2.5711)&gt;
1683
&lt;Vector (3168.8081, -1.3707, -2.5711)&gt;
1684
&lt;Vector (3168.8081, -1.3707, -2.5711)&gt;
1685
&lt;Vector (3168.8081, -1.3707, -2.5711)&gt;
1686
&lt;Vector (3168.8081, -1.3707, -2.5711)&gt;


What am I doing wrong, how can I get the location of the cubes’ vertex at a given frame?
Instead of setting scene.frame_current = frame, run scene.frame_set(frame),

The docs mention this since its a common issue.

Updating all objects animation state in a scene can be very heavy with complex scenes, so it was decided not to do this on setting the frame attribute.