'Is there a way to set a.py in a loop to keep memory for b.py
I have a Python 3.7 program that gets run by another program every 5 to 7 seconds then closes. I want to pass a single string variable from that program before it closes to a second Python program that runs in a continuous loop to keep track of that information and have it pass the information back to the first program when it starts. I realize this could be handled by writing the information to a file then reading it, however; I am running the system off a flash memory and that would be an excessive amount of writing and rewriting considering how often the information changes.
Nothing yet, as there is a power outage and the system is down. Besides, I'm new to Python and I'm not sure the best way to handle this.
Could it be done something like this?:
Memory.py
#!/usr/bin/env python
import time
Tracking = "Home"
def Memory():
return Tracking
while 0 == 0:
from vortex import Memory
Memory = Tracking()
print(Memory)
time.sleep(1)
vortex.py
#!/usr/bin/env python
from Memory import Tracking
Tracking = Memory()
def Memory():
return Tracking
The Python program I have working so far controls a second system but the controls are limited to up, down, right, left, back and select. Options on the menu of the second system are Home, FrontCamera, FrontDoorCamera, BackdoorCamera, BackyardCamera, Weather. I want to keep track of which one it's on (first system.)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
