I can add the menu through the following code
import pymel.core as pm
parent_object = pm.getPanel(sty="graphEditor")[0]
pm.menu("test_menu", parent=parent_object, label="Test Menu", tearOff=True)
However as soon as I tear off the graph editor panel, I lose the menu. How can I make this permanent for the graph editor window or any other scripted panel?
Also if I tear off the graph editor panel and close it, and if I try running the above code, I get the following error
maya\Python\lib\site-packages\pymel\internal\pmcmds.py line 134: Layout must be a menuBarLayout: graphEditor1 #
Cheers
Pritish