How do I add my addon's submenu over Quick Favourites when I press Q key?

Hey guys,

So the goal is to register my addon’s submenu under Q key. I only found one example (see code below), which does register my operators under Q key, but unfortunately it completely overrides the previous definition of Q

def register_keys():
    wm = bpy.context.window_manager
    kc = wm.keyconfigs.addon

    if kc:
        km = kc.keymaps.new(
            name="3D View",
            space_type='VIEW_3D'
        )
        kmi = km.keymap_items.new(
            "wm.call_menu",
            type='Q',
            value='PRESS'
        )
        kmi.properties.name = "MYADDON_MT_quick_menu"
        addon_keymaps.append((km, kmi))

I’ve seen addons where this functionality is implemented and their defined submenus are placed above “Quick Favourites”. Is there any simple way to do that?

I was searching internet and couldn’t find anything I can work with.

Thanks

How do you get to both your add-on commands and Quick Favorites now without having one take over Q?

By right clicking the operator and choosing Add to Quick Favorites:

This menu is for the user to customize. It would not be a good idea to edit it programmatically, unless your add-on specifically deals with managing the quick favorites menu.

You could probably append something to that menu. I would start searching for “bpy append menu” and you can find out the name of the menu from the keymap in the preferences by searching for Q key. I don’t think it’s a good idea to just add stuff there though. The user should choose what’s there.