How to make macOS cmd+tab switch desktops when app is on a different desktop

Say I have ProgramA running in desktop space 1, and ProgramB running in desktop 2. If I am currently on space 1, and cmd+tab to select ProgramB, then I still stay on space 1 even though there is no window for ProgramB on this space.

Is there a way (or an external program I can download) to make the desktop space automatically switch to one with an active window of the program I selected?

I am on MacOS Mojave.


Solution 1:

System Prefs > Mission Control > When switching to an application, switch to a Space with open windows...

enter image description here