From the top menu to the inspector.

Hello guys, I came up with an idea, how can I do it from the top menu, for example, I select some script so that this script is opened by an inspector with some script? (Not selected in the scene but present)

[MenuItem] if you wanted to know how to create a menu item. The part about selecting, opening script with script is too vague, please clarify.

I click on the menu item in the top menu and the script opens in the inspector. Like the picture below: