Access to duplicate object

i’m working on a uipanel button to vary a size of an object 10 times in a row and have them in succession, like an array but each cube has diff size. to do this i need access the duplicate object and have it resized, but how to access duplicate object?
i found this but it did not work with my code some reason

import bpy

class MESH_OT_Add_Array(bpy.types.Operator):
    bl_label = "random duplicator 10"
    bl_idname = "mesh.add_array"
    def execute(self, context):
        bpy.context.object.modifiers["Array"].count = 10
        for m in bpy.context.active_object.modifiers:
            if m.type=='ARRAY':
        return {'FINISHED'}
        obj ="Cube")
        dupObj = obj.copy()
        return {'FINISHED'}

class ULTIMATE_PT_Panel(bpy.types.Panel):        
    bl_label = "Ultimate Duplication"
    bl_idname = "ULTIMATE_PT_Panel"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'UI'
    bl_category = 'Ultimate Duplication'
    def draw(self, context):
        layout = self.layout
        # col = layout.column()
        row = layout.row()
        row.operator("object.duplicate_move", icon="DUPLICATE")
        row = layout.row()
        row.operator("mesh.add_array", icon="MOD_ARRAY")

def register():
def unregister():

if __name__ == "__main__":

Here’s something that worked for me:

scn = bpy.context.scene
bpy.ops.object.select_all(action='DESELECT') = True
#duplicates obj
bpy.ops.object.duplicate ({"linked": False})
c_objs = [c for c in scn.objects if]
duplicate = c_objs[1]

changing selection states and using bpy.ops inside of scripts is generally a bad idea if it can be avoided. less error prone and more concise to work with the data api directly

duplicate_obj = obj.copy()
if is not None:                  # empties don't have data =  # skip this step if you want linked data