hiya,
It is explained in the doc a lot better than i could explain
i am not sure to rember the command for the head line menu, here an exemple with a toolbar menu (to put in a menu.py) :
mytools=nuke.toolbar('Nodes')
mytools.addMenu("MyMenu", icon="me.xpm")
mytools.addCommand("MyMenu/Reordering", "reordering_1v1.main()")