You can use REPL for micro: bit.
If you move Serial to GPIO, micro: bit will be able to communicate with another MCU in serial, making it possible to run the program on the fly even in the absence of PC.
It is troublesome if you do not switch serial to USB and GPIO at any time.
I made a simple program.
Every time you press micro: bit button A, switch UART between USB and GPIO.
Code
from microbit import *
mode=0
while True:
if(button_a.get_presses()):
if(mode==0):
#change to Serial via GPIO pin
uart.init(baudrate=9600, bits=8, parity=None, stop=1, tx=pin0, rx=pin1)
display.scroll("Serial 0,1")
mode=1
else:
#change to USB Serial
uart.init(115200)
display.scroll("Serial USB")
mode=0
First switch the UART to GPIO by pressing the button. TX is pin 0, RX is pin 1, and GND.
Connect these to the USB Serial adapter.
Connect from the PC at the terminal.
For example, screen /dev/ttyUSB0 9600
Stop the program with CTRL + C and confirm that you can use REPL.