Move objects in different position

Hi there!!!
I have this problem:
I have 10 object and I want to set the keyframe . I have two sets of coordinates. So what is wrong in this script? Thanks in advance for your help!!
:eek:

import bpy

#in this list I have all my atom coordinate of single object...             
position =[[(-0.63, 15.929, 4.741), (0.676, 15.268, 4.992), (0.636, 13.793, 4.605), (0.347, 12.931, 5.435), (0.994, 15.42, 6.476), (-0.053, 16.352, 6.982), (-1.235, 16.208, 6.055), (1.436, 15.769, 4.411), (0.937, 14.456, 6.96), (1.983, 15.834, 6.596)]]
conf =[(-0.244, 12.116, 8.079), (0.442, 11.383, 6.981), (0.548, 12.23, 5.713), (-0.289, 13.095, 5.459), (-0.357, 10.112, 6.707), (-1.582, 10.257, 7.545), (-1.213, 11.182, 8.679), (1.434, 11.115, 7.311), (-0.599, 10.051, 5.655), (0.221, 9.248, 7.0)]


frame_num = 0
for i in conf:
    bpy.ops.mesh.primitive_uv_sphere_add(size=0.6,location=i)
    bpy.context.scene.frame_set(frame_num)
    bpy.ops.anim.keyframe_insert(type='Location', confirm_success=True)
    obj_name = bpy.context.object


obl = bpy.data.objects
mesh_objects = []
for i in obl:
    if i.type == 'MESH':
        mesh_objects.append(i.name)
item = 0
for obj in mesh_objects:
    bpy.ops.object.select_name(name=obj)
    frame_num = 10
    
    for ro in position[0]:
        print(ro)
        bpy.context.active_object.location = ro
        bpy.context.scene.frame_set(frame_num)
        bpy.ops.anim.keyframe_insert(type='Location', confirm_success=True)
        frame_num += 10

do you have 2 atoms with 10 positions in space each?
or 10 atoms with 2 positions in space each.


import bpy

#in this list I have all my atom coordinate of single object...             
position =[(-0.63, 15.929, 4.741), (0.676, 15.268, 4.992), (0.636, 13.793, 4.605), (0.347, 12.931, 5.435), (0.994, 15.42, 6.476), (-0.053, 16.352, 6.982), (-1.235, 16.208, 6.055), (1.436, 15.769, 4.411), (0.937, 14.456, 6.96), (1.983, 15.834, 6.596)]

conf =[(-0.244, 12.116, 8.079), (0.442, 11.383, 6.981), (0.548, 12.23, 5.713), (-0.289, 13.095, 5.459), (-0.357, 10.112, 6.707), (-1.582, 10.257, 7.545), (-1.213, 11.182, 8.679), (1.434, 11.115, 7.311), (-0.599, 10.051, 5.655), (0.221, 9.248, 7.0)]


# start positions?
for i in conf:
    bpy.ops.mesh.primitive_uv_sphere_add(size=0.6,location=(0,0,0))
  
# making a list of 'MESH' type objects to move
obl = bpy.data.objects
mesh_objects = []
for i in obl:
    if i.type == 'MESH':
        mesh_objects.append(i.name)
        
# placing each object at another coordinate
item = 0
for obj in mesh_objects:
    #print(obj)
    bpy.ops.object.select_name(name=obj)
   
    frame_num = 0
    #print(conf[item])
    bpy.context.scene.frame_set(frame_num)
    bpy.context.active_object.location = conf[item]
    bpy.ops.anim.keyframe_insert(type='Location', confirm_success=True)
    
    frame_num = frame_num + 10
    #print(position[item])
    bpy.context.scene.frame_set(frame_num)
    bpy.context.active_object.location = position[item]
    bpy.ops.anim.keyframe_insert(type='Location', confirm_success=True)

    print(obj, "moves from: ", conf[item], "to", position[item])
    item+=1


from what I could see -besides any mess that zeffii had surely cleaned up- you were moving objects before jumping to new frame, so that resets position to previous keyframe… you should move in time then move object then keyframe

Thank a lot for the help!!!

mark it [Solved] go to your first post -> advanced , at the top change the prefix.