I'm using raspberry pi 3 and i can communicate to a port via terminal using the following commands:
to open port

ssty -F /dev/ttyUSB2 -echo


cat /dev/ttyUSB2&

To send messages i use:

echo 'AT' > /dev/ttyUSB2

The response of the port is 'OK'
I doing a python code to save the answers of the terminal in a variable, i tried to use the pySerial library but doesn't work, is there any another method that i can use?
Just use "serial" library. I use it and works good.
Python reading and writing to ttyUSB