Unregister an operator in the menu, (bugg)?

“remove” doesn’t seem to work for me (tested in 2.82 / 2.83 /2.9)
More and more copies are created when I run the script. Did I forget something?

python template: addon_add_object.py

# Registration
def add_object_button(self, context):
    self.layout.operator(OBJECT_OT_add_object.bl_idname,text="Add Object",icon='PLUGIN')

def register():
   bpy.types.VIEW3D_MT_mesh_add.append(add_object_button)

def unregister():
    bpy.types.VIEW3D_MT_mesh_add.remove(add_object_button)

Are you sure the unregister function is actually run? The template might only run register when you execute it in the text editor.

2 Likes

Good to know, thank you very much!
is there a smart solution to call unregsiter() or remove() from the console? Or does it have to be registered as an addon first.

I’m not aware of a smart solution for that, unfortunately.

1 Like