What is the real intention - just having a bidrectional communication with the Raspberry Pi with text commands ending with \n?
If yes, then why not using the ethernet? Sending e. g. UDP/HTTP packets in both directions should work.
Or using RS232 the UART pins + some electronics and a USB-to-serial adapter from a 2nd USB port?
Thonny Python IDE communicates with the Raspberry Pi via USB too? Then what works and what does not - is probably defined by Thonny.
I normally access my Raspberry Pi via ethernet/SSH and start the python scripts directly in the shell console of the Ubuntu running on my Raspberry. There is even a command line debugger in python integrated - on Raspberry too?
If you don't use Thonny Python IDE the USB is unused and could be perhaps reconfigured with a proper library and simulate a serial interface for the connected PC (similar to FTDI's chip for RS232 = UART = serial interface).
Asking in the raspberry pi forum could bring also help.