Program design:

  • Class A, which implements lower level data handling
    • Classes B-E, which offer a greater level interface to some to do various functions
      • Class F, the industry UI object that interacts with B-E based on user input

There are only able to be one instantiation of the at any time, to prevent race conditions, data corruption, etc.

What's the easiest method to give a copy of One place to another-E? Presently F instantiates A and keeps it for that existence from the program, passing it to B-E when designing them. Alternately I possibly could produce a globally available module having a shared copy of the that everything uses. Another alternative would be to make B-E subclasses of the, but that violates the constraint of just one A (since each subclass could be their very own data handler, as they say).

Language is Python 3, FWIW.

Make use of a Borg rather than a Singleton.

>>> class Borg( object ):
...     __ss = {}
...     def __init__( self ):
...             self.__dict__ = self.__ss
>>> foo = Borg()
>>> foo.x = 1
>>> bar = Borg()
>>> bar.x

What about while using module technique, this really is easier.

in module ""

class A(object):
   def __init__(self, ..)
a = A()

in module ""

from A import a

class B(object):
   def __init__(self)
       global a
       self.a = a

The two have single instance a.

Exactly the same might be accomplished for other classes C, D, F etc