How is called the Panel menu in python?

I want to know how to call this menu in python so I can “prepend” or “append” some function.


You can’t, it’s hardcoded:

 * menu to chow when right clicking on the panel header
void ui_panel_menu(bContext *C, ARegion *ar, Panel *pa)
    bScreen *sc = CTX_wm_screen(C);
    PointerRNA ptr;
    uiPopupMenu *pup;
    uiLayout *layout;

    RNA_pointer_create(&sc->id, &RNA_Panel, pa, &ptr);

    pup = UI_popup_menu_begin(C, IFACE_("Panel"), ICON_NONE);
    layout = UI_popup_menu_layout(pup);
    if (UI_panel_category_is_visible(ar)) {
        char tmpstr[80];
        BLI_snprintf(tmpstr, sizeof(tmpstr), "%s" UI_SEP_CHAR_S "%s", IFACE_("Pin"), IFACE_("Shift+Left Mouse"));
        uiItemR(layout, &ptr, "use_pin", 0, tmpstr, ICON_NONE);

        /* evil, force shortcut flag */
            uiBlock *block = uiLayoutGetBlock(layout);
            uiBut *but = block->buttons.last;
            but->flag |= UI_BUT_HAS_SEP_CHAR;

    UI_popup_menu_end(C, pup);


Oh I see :(. I intended to make an addon that lets you change the bl_category of a Panel, allowing custom interface.
Remain the idea so.