Best way to handle this is to assign a custom key for the second app.
For example, if rcmd focuses Mail on
M and you want to assign
U for Music:
And that's it, from now on you can use
U to focuse the Music app.
If you have multiple apps with the same first letter, pressing that letter multiple times will cycle between those apps.
For example, if you have Safari, Spotify and Shortcuts running:
Swill focus Safari
Sagain will cycle and focus Spotify
Syet again will cycle and focus Shortcuts
Unfortunately there's no macOS API that allows us to focus specific windows of an app.
The Accessibility API would allow this in some manner but it is not allowed on the App Store.
If all windows are closed or minimised for an app, focusing that app won't show any window.
Unfortunately circumventing this needs special permissions to simulate a click on the Dock, and this is not allowed on the App Store.