Where do I find the complete list of the type of all the menus?

For example, Mesh Add menu is ‘INFO_MT_mesh_add’ and Special menu in edit mode is ‘VIEW3D_MT_edit_mesh_vertices’. Or can I check the type of a particular menu directly from UI?

You can find this stuff by using the console (shift+f4) and its autocomplete function(ctrl+space). If you type bpy.types. and then press ctrl+space, it will display a list of completions.

or use in the console:
results = dir(bpy.types) #:wink:
and do something you want to know …


>>> res = dir(bpy.types)
>>> for el in res: 
...  if el.startswith('WM_OT'):
...   print(el)

Then how do I know the name of a particular menu? For example, I hit Shift+S to open “Snap Menu”, then how do I know its type?

Well, since it’s viewport-related, you can assume the prefix will be ‘VIEW3D’. Since it is menu type, the next part will be ‘MT’.

You use the [ctrl]+[space] autocomplete to build it up, narrowing down the options until you find what you’re looking for.
Starting with bpy.types.VIEW3D_MT_{autocomplete} you will see all the VIEW3D_MT_… snap is one of them.

And then there is the perhaps-more-pythonic-way:


for menu in bpy.types.Menu.__subclasses__():
    print(menu.bl_label,menu)