# How to delete an existing 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.

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):

bpy.types.TOPBAR_HT_upper_bar.draw = draw_function


When I tried a similar method, the def function could not be specified correctly in register.

I learned how to use "lambda s, c: s.layout.separator ()".

Using lambda in register, simply defining an empty function and emptying the menu.

´´´Python

import bpy

self.layout.label(text="foo",icon="NONE")

return {'FINISHED'}

keep_TOPBAR_HT_upper_bar = bpy.types.TOPBAR_HT_upper_bar.draw

def register():
lmda = lambda s,c:s.layout.separator()
bpy.types.TOPBAR_HT_upper_bar.draw = lmda