# How to change the order of a custom function added in the dropdown menu in the header region in 2.81 with python

The duplicate post doesn't address the items in the dropdown. Only the bpy.types. The dropdown isn't part of that.

I'm have added a custom function to the face dropdown in the header region when in Edit mode. by appending to bpy.types.VIEW3D_MT_edit_mesh_faces

How do I change the order of my function in the dropdown list?

Here is a similar question but is addressing a different part of the UI.

what it looks like now:

what I want to see happen (doctored image):

The script so far:

bl_info = {
"name": "Custom Algo",
"blender": (2, 80, 0),
"category": "Face",
}

import bpy

class CustomAlgo(bpy.types.Operator):
"""Custom Algo"""
bl_idname = "face.Custom_algo"
bl_label = "Custom Algo"

def execute(self, context):
print("Pretend that you have done something sticky with that face")
return {'FINISHED'}

def menu_func(self, context):
self.layout.operator(CustomAlgo.bl_idname)

def register():
bpy.utils.register_class(CustomAlgo)
bpy.types.VIEW3D_MT_edit_mesh_faces.append(menu_func)

def unregister():
bpy.utils.unregister_class(CustomAlgo)
bpy.types.VIEW3D_MT_edit_mesh_faces.remove(menu_func)

if __name__ == "__main__":
register()

• The answer is still the same as the question you linked: You can either prepend or append or do one of the workarounds listed. – Ray Mairlot Dec 2 '19 at 23:07
• I think the existing answers are not clear. The accepted answer has dead links in it... A clear and well structured answer would be useful. I am voting to reopen it. – Martynas Žiemys Dec 3 '19 at 19:54
• @Školstvo, you can re-register the whole menu in an add-on. You can right-click Blender's UI in some places and choose edit source to find out stuff like this. This menu is copied from source. – Martynas Žiemys Dec 3 '19 at 21:00
• Sorry, I completely forgot about this – Martynas Žiemys Dec 3 '19 at 21:07
• I thought that re-registering a complete menu would mess up other add-ons trying to add stuff to it, but it seems to work when I test it even if I have one addon with new menu and another appending to it and in fact it's on a header that I have completely rewritten in another addon... I am not a professional programmer and lack in-depth knowledge in the area so there might be other problems with this, but I can see none at the moment. – Martynas Žiemys Dec 3 '19 at 21:15