# incorrect context animating a mesh

blender newbie here, i am trying to animate a mesh made up of vertices and faces. I have a list of the vertices that I want to make up the object for each timestep, but I am running into problems making and joining the objects. I get the error 'RuntimeError: Operator bpy.ops.join_shapes.poll() failed, context is incorrect'. I've looked at other threads but I still dont understand what is going on

context = bpy.context
scene = context.scene

obs = []
for i in range(T):

mesh = bpy.data.meshes.new( "grid" )
obj = bpy.data.objects.new( "grid", mesh )

obj.data.from_pydata( verts[i], [], polygons )
obs.append(obj) #add to list of objects

scene.objects.active = obs.pop(0)

for ob in obs:
ob.select = True

bpy.ops.object.join_shapes()



is it something to do with the fact I make new objects within the loop which then aren't added to the scene? and should I be using bmesh?