How to apply Priority change of MenuItem immediately?

If I change the priority of a menuitem, it won’t take effect immediately.(The menuitem will be in the same order, ignore the change.)
I have to restart editor to make the priority change applied.

What can I do to make this change applied immediately?
Is there any script that can pretend an editor restart?