Jan-15-2018, 10:23 PM
(This post was last modified: Jan-15-2018, 10:23 PM by Gribouillis.)
Yes, you can have a common module that contains the data shared by other parts of your app (or provides access to such data). Other modules import the common module. For example
# common.py class SharedState: def __init__(self): self.foo = 14 state = SharedState() # module sensors.py from common import state def bar(): print(state.foo + 1) # module mcp3008.py from common import state qux = state.foo ** 2 print('etc')