How to delete an existing menu? I want to replace an existing menu with an add-on.
You can add your own menu with "append" or "prepend", but you want to delete your existing menu and add your own menu.

If you simply empty an existing class as shown below, you can delete the existing menu, but it will continue to output errors to the console.

Delete the top bar menu

bpy.types.TOPBAR_HT_upper_bar.draw = None
bpy.types.TOPBAR_HT_upper_bar.draw expects a draw function. Here is an example for how to replace the built-in draw function with your own:

import bpy

def draw_function(self):
    self.layout.label(text="New Custom Menu")

bpy.types.TOPBAR_HT_upper_bar.draw = draw_function