# How can I get the id name of a submenu?

I'm looking at the ui_menu.py template script in Blender, and line 19 shows this line:

layout.operator_menu_enum("object.select_by_type",
property="type",
text="Select All by Type...",
)


I thought I could find the id name "object.select_by_type" by hovering over Select -> Select All by Type... in the 3D viewport, but when I did, I couldn't see any grayish popup saying something like "Python: object.select_by_type()". How can find the id name of submenus like this one?

If it's from operator_menu_enum(), you can hover your mouse over each option and the description will have the same function. For example, in Select -> Select All by Type..., each option you hover over has the description Python: bpy.ops.object.select_by_type(type='[some option]'). That's a good hint to say that the "Select All by Type..." menu was made from self.layout.operator_menu_enum().

(As a side note, I also see that the parameter name shown in the description is what you put in the property parameter when you're calling operator_menu_enum(). So since the parameter name in select_by_type() was "type", I'd call something in a custom script like self.layout.operator_menu_enum(operator = "object.select_by_type", property = "type", text="select_menu test"). And if I was making my own operator subclass for operator_menu_enum, apparently the variable name for the EnumProperty() you define is the string you put in the property parameter of operator_menu_enum(). I guessed that from this question.)

If the menu is made from self.layout.menu(), you can hover over each option and you'll see different function names in the description. An example is View -> Align View. To find the id name string that you can use in self.layout.menu(), you can do a search in bpy.types. For example, here's the code and output I got from the Python Console when I was searching up bpy.types:

>>> for i in dir(bpy.types):
...     if "align" in i: print(i)
...
ARMATURE_OT_align
IMAGE_MT_uvs_weldalign
OBJECT_OT_align
UV_OT_align
VIEW3D_MT_view_align
VIEW3D_MT_view_align_selected


I checked for "align" in the if statement because I thought it was the most logical thing, seeing that the submenu name was "Align View". And also by best guess, I saw that "VIEW3D_MT_view_align" was the id name for this submenu (I double checked in a custom script with something like self.layout.menu(menu = "VIEW3D_MT_view_align", text = "align test")). Anyways, that's the best I can come up with. I couldn't find anything in google this time.