Menu list keeps on growing every time I debug my Operator script This is a question about the process of developing an addon rather than a specific error in the script.
I'm creating an Operator that I want to show up in the UV Unwrap menu.  I'm editing the script in the Scripting tab and every time I want to try the latest version of my code, I press the little arrow button to run my script. Unfortunately, every time I do a new entry is added to my menu list, so over a programming session my menu quickly fills up with lots of identical entries to run my operator.  I just want a single menu entry.  I thought my operators unregister() method would take care of this, but it does not seem to.
What would be a better workflow to develop my addon?
import bpy
from bpy.props import FloatProperty

class UnwrapWorldUvOperator(bpy.types.Operator):
    bl_idname = &quot;uv.unwrap_world_space&quot;
    bl_label = &quot;Unwrap World Space Operator&quot;
    bl_options = {'REGISTER', 'UNDO'}

    scale: FloatProperty()

    @classmethod
    def poll(cls, context):
        obj = context.active_object
        return obj and obj.type == 'MESH' and obj.mode == 'EDIT'

    def execute(self, context):
        print (self.bl_idname)
        return {'FINISHED'}

def menu_func(self, context):
    self.layout.operator(&quot;uv.unwrap_world_space&quot;)    

def register():
    bpy.utils.register_class(UnwrapWorldUvOperator)
    bpy.types.VIEW3D_MT_uv_map.prepend(menu_func)


def unregister():
    bpy.utils.unregister_class(UnwrapWorldUvOperator)
    bpy.types.VIEW3D_MT_uv_map.remove(menu_func)


if __name__ == &quot;__main__&quot;:
    register()
You can test whether menu_func is already part of _draw_funcs list and if so, do not prepend:
def register():
    bpy.utils.register_class(CUSTOM_OT_operator)
    
    if hasattr(bpy.types.VIEW3D_MT_uv_map.draw, '_draw_funcs'):
        if menu_func.__name__ not in (f.__name__ for f in bpy.types.VIEW3D_MT_uv_map.draw._draw_funcs):
            bpy.types.VIEW3D_MT_uv_map.prepend(menu_func)
    else:
        bpy.types.VIEW3D_MT_uv_map.prepend(menu_func)

def unregister():
    bpy.utils.unregister_class(CUSTOM_OT_operator)
    bpy.types.VIEW3D_MT_uv_map.remove(menu_func)


if __name__ == &quot;__main__&quot;:
    register()