in reply to Re^3: how to connect two DUT console in script
in thread how to connect two DUT console in script

I notice you configure $port e.g. $port->baudrate(115200);, but not $port1.