Switching between two tcp connections using python script

I need to control two drones separately from a python script (real ones and in SITL). I am connected to two different SITL simulations in mission planner (1.3.49), I can manual switch from one connection to annother with the selection box near the “connect” button. My question is how i can do it from a python script?

Thank you!

I’m not sure if this will work. but
"Ports" exposes all connections
and “MAV” is one of those ports
so you could try assign a different port to MAV, and see what happens