Programmatically invoke Prosemirror menu commands

Hi, How can i invoke a menu command Programmatically?

Find out what function is bound to the menu item, import it, and call it. Not all menu items make sense as command functions though, so not all of them might be exported.

thank you