title: Read and write in a serial port using two different script
body: <p>I am trying to handle a SIMCOM Modem (SIM7100E) over a serial port using AT command.
  To do that, I am trying to build a script that will always listen to the serial port and handle answer like:</p>
  <pre><code>import serial
  
  ser =serial.Serial('/dev/ATModem_SIM2',115200)
  while True:
      line=ser.readline()
      print(line)
  </code></pre>
  <p>and using another script, I tried to send AT commands to the same serial port:</p>
  <pre><code>echo &quot;AT&quot; &gt; /dev/ATModem_SIM2 
  </code></pre>
  <p>while expecting to read OK in the python script, I read &quot;AT\n&quot; and not the answer!</p>
  <p>Note: The Modem works fine and I already test it using <a href="https://sourceforge.net/projects/catty/" rel="nofollow noreferrer">catty</a> and I get the answer:</p>
  <pre><code>root@phyboard-mira-imx6-5:~# catty  -d /dev/ATModem_SIM2 -b 115200 -1 -8 -n -l -r 8 -s 10 -t 100 -x -w &quot;AT\r&quot;
  AT
  OK
  root@phyboard-mira-imx6-5:~# catty  -d /dev/ATModem_SIM2 -b 115200 -1 -8 -n -l -r 8 -s 10 -t 100 -x -w &quot;ATI\r&quot;
  ATI
  Manfacturer: SIMCOM INCORPOATED
  Revision: SIM7100E_V4.5
  IMEISV: xxxxxxxxxxxxxx
  +GCAP: +CGSM
  
  OK
  </code></pre>
  <p>Here is a diagram of what I am trying to do:
  <a href="https://i.stack.imgur.com/a1K1T.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/a1K1T.png" alt="enter image description here" /></a></p>