Your code does a completely different thing - it doesn’t call any menu item; it checks whether the form was called from a menu item with a given name.
Please give us a more detailed description of your requirement. For example, maybe you have a menu item button in the form you’re extending and your intention is getting the same behaviour as if a user clicked the button. Then it might be useful to know at which situation you want to execute this logic.
[mention:c291c7c4ff374fa7addbd7a117f91ec7:e9ed411860ed4f2ba0265705b8793d05]: Can you explain how your reply addresses the problem?