Prusa printer keeps disconnecting

Prusa MK3S printers have a port on their mainboard that can be used to connect a Raspberry Pi Zero W to. The printer will rather talk with that Raspberry if it has the settings say so. If your Raspberry Pi is connected through the USB port on your printer, editing a setting in the menu on your printer should solve the problem. Go to LCD menu -> Settings -> RPi port and set it to "Off".

Try connecting to the printer again and see if it solved the problem.