setting hook location frame to frame I would like to animate an object using vertices as anchors. Blender 2.70a implements the Laplacian deformation method for methods. I have the following code to familiarise myself with hooks. As a trial, I create a for loop to increment the frame number and set the hook location in that frame to a position chosen from a list of coordinates. However, when I scroll back through the frames, the hook location is always in the same place. So the following code is setting the hook location for the entire timeline, not frame-by-frame.

import bpy

# use default cube
ob = bpy.data.objects['Cube']
obdata = bpy.data.meshes['Cube']

# make sure everything is deselected before selecting vertex for hook
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
bpy.ops.mesh.select_all(action="DESELECT")
bpy.context.tool_settings.mesh_select_mode = [True, False, False] # (Vertex,Edge,Face)
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)

# select vertex, add hook, rename to Hook1
obdata.vertices[0].select=True
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
bpy.ops.object.hook_add_newob()
bpy.data.objects['Empty'].name = "Hook1"

# create a list of positions to move the hook through
positions = [(0,0,-2),(0,1,-2),(3,2,-1),(3,4,-1),(1,2,-1)]

scene = bpy.context.scene

frame=0

for position in positions:
  scene.frame_set(frame)
  bpy.data.objects['Hook1'].location = position
  print( bpy.data.objects['Hook1'].location )
  bpy.data.objects['Hook1'].keyframe_insert(data_path="location", frame=frame, index=-1)
  frame+=10


UPDATE: Added keyframe insertion.
In order for blender to store the location on each frame, you must insert a keyframe.

See the blender API reference for details.