Sort and duplicate objects in a list

bpy.context.selected_objects is kinda weird, but actually the order is by time object created so from old to new

how blender object work some thing like this
– Object [location, scale, rotation, ect…]
– – Data [mesh:(vertex, edge, face), armature:(bone), ect…]

we can share data to another object (Link), so when we edit the geometry on object A the object B is effected

for more information : https://docs.blender.org/api/current/bpy.types.Object.html

there’s many way to duplicate object, here some beginner friendly snippet code

import bpy

# get selected objects
selected_objects = bpy.context.selected_objects.copy()

# deselect all object
bpy.ops.object.select_all(action='DESELECT')

duplicated_objects = []

for obj in selected_objects:
    # deselect all object
    bpy.ops.object.select_all(action='DESELECT')

    # select object
    obj.select_set(True)

    # duplicate object
    bpy.ops.object.duplicate_move(OBJECT_OT_duplicate={"linked":False, "mode":'TRANSLATION'})

    # get and store duplicated object
    duplicated_object = bpy.context.selected_objects[0]

    # append to duplicated_objects
    duplicated_objects.append(duplicated_object)

print(duplicated_objects)

for more information : https://docs.blender.org/api/current/bpy.ops.html