# ref: https://s-nako.work/2020/12/how-to-pass-arguments-to-custom-operator-in-blender-python/ class ADDMATRIX_add_cube(bpy.types.Operator): bl_idname = 'add_matrix_obj.add_cube' bl_label = "Add matrix cube" bl_options = {'REGISTER', "UNDO"} input1: bpy.props.IntProperty() # add argument1 as property "input1" input2: bpy.props.IntProperty() # add argument2 as property "input2" def execute(self, context): for xi in range(self.input1): x = xi*1.2 for yi in range(self.input2): y = yi*1.2 bpy.ops.mesh.primitive_cube_add(size=0.5, enter_editmode=False, align='WORLD', location=(x, y, 0)) return {'FINISHED'}