Need a robust way to change uart lines
The Arduino line uses a simple resistor setup to give one Tx/Rx pair priority over another.



The direct connection has priority over the resistor connection.

Note that this depends on the specific board you use, as some have the resistors going to the programmer and others to the external module. The Uno R3 has them to the programmer.

See: Arduino Uno R3 hardware serial: peripheral interfering with the USB/Serial-converter?