Making use of Menu Objects?

Hi team,

I am building the same menu twice– once for the Nuke menu, and once for the Nodes menu. It’s a lengthy list of items to .addCommand() with, and it slows down Nuke’s boot. There must be a better way.

My thought was to build the menu once, store it, and then use it to make the second menu by passing a Menu Object to some kind of makeMenu function. Apparently there is no such function?

I wish this would work, but Menu Objects just seem to have no place as arguments in Nuke:

mainMenu = nuke.menu("Nuke")
subMenu = mainMenu.addMenu("Misc")
subMenu.addCommand("One", "")
subMenu.addCommand("Two", "")
subMenu.addCommand("Three", "")
nodeMenu = nuke.menu("Nodes")
nodeMenu.addMenu(subMenu)

Thoughts?
Many thanks.