Is there a way to open the app only on the currect screen? [duplicate]

I have a MacBook pro and I connected the additional screen to it, so I have two screens one of the MacBook and the other one is that I connected. The situation is that I work with XCode and I opened two instances of it one XCode window I put on the first screen and another window of it I put on the second screen, then (eg:) I opened Safari browser on the first screen and on the second one I opened Finder(or something else), so in this case, my XCode windows left behind. Now I need to get the XCode window back on the second screen, BUT I want to leave the Safari browser on the first screen, the problem is that if I move the mouse to the bottom panel where is XCode icon and click on it (in order to bring it forward as on Windows) as a result it brings me forward XCode on both first and second screens, so I need to go and open Safari on the second screen. It is very annoying because each time I expect that it opens me XCode on the screen where I invoke it, it opens it on both screens (because I have 2 of the instances). I would like to get functional as on Windows, when I go to the specific screen and open the app on that screen, it opens exactly on that screen and doesn't bring forward all windows of the app on all the screens. It is a little bit confusing, but I hope you got my idea. Are there any solutions for it?


You're fighting a paradigm shift.

Opening an app twice on Windows will actually launch two separate instances of the app. On Mac it will not. It will merely add another view into the same instance.

Bringing that app to the front will [almost] always bring all windows of that app to the front too. There have been some bugs over the years where that fails to happen - Finder has famously got worse for that since about Sierra, but otherwise the 'all to front' implementation is expected behaviour.