Say you have a config.py
which inside has
settings = read_yaml('settings.yaml')
so config.settings
is a dictionary.
in one script foo.py
you have:
import config
config.settings['foo'] = str(time.time())
write_yaml('settings.yaml', config.settings)
and in another script bar.py
you have
import config
while True:
sleep(10)
print config.settings['foo']
How would you keep the printed value in bar.py
up to date with the new value after running foo.py
at any time without the obvious reading the file again seeing as the while loop in bar.py
needs to be as quick as possible!
I currently run these on seperate bash threads i.e:
$ python bar.py
$ python foo.py
But I could run bar in a thread if that is possible?