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

2 Answers 2


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

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.

In addition, it was solved by adding the function you want to add with prepend.


import bpy

def IHUSEFUL_HT_menu(self, context):

    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


def unregister():
    bpy.types.TOPBAR_HT_upper_bar.draw = keep_TOPBAR_HT_upper_bar

if __name__ == "__main__":



You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .