2

I have a Python program named read.py which reads data from serial communication every second, and another python program called calculate.py which has to take the real time values from read.py.

Using subprocess.popen('read.py',shell=True) I am able to run read.py from calculate.py

May I know how to read or use the value from read.py in calculate.py? Since the value changes every second I am confused how to proceed like, saving value in registers or producer consumer type, etc.

for example : from import datetime when ever strftime %s is used, the second value is given how to use the same technique to use variable from another script?

David Buck
  • 3,752
  • 35
  • 31
  • 35
santa
  • 21
  • 1
  • 1
    Did you take a look at [this](https://stackoverflow.com/questions/35157367/how-to-share-data-between-python-processes) and [this](https://stackoverflow.com/questions/45066782/exchange-data-between-two-python-processes)? – Gerd Nov 07 '19 at 11:23

1 Answers1

1

I can suggest writing values to a .txt file for later reading

mind-protector
  • 248
  • 2
  • 12