Mailing List Archive

How/where to store calibration values - written by program A, read by program B
Many years ago, Fredrik Lundh provided an answer for this question
on his website effbot.org. Unfortunately that site has gone, but luckily,
it has been preserved in the "wayback machine"...

https://web.archive.org/web/20200724053442/http://effbot.org:80/pyfaq/how-do-i-share-global-variables-across-modules.htm

In short, create an empty file named something like 'config.py' or
'shared.py' in a folder that both scripts can use.
Import the file in both scripts.

import shared

Then when you want to share a value, use...

shared.variablename=3.14159

The file can then be accessed by both scripts.

The biggest caveat is that the shared variable MUST exist before it can be
examined or used (not surprising).

I sincerely hope this helps.

Greg
--
*My memory check bounced*



Greg Walters
--
https://mail.python.org/mailman/listinfo/python-list