title: Python passing handle to interface to multiple modules
body: <p>I have a python program with multiple modules. There is a module that contains code to initialize a UDP Interface to send messages. I would like this Interface to be used across all the modules. The only way I've thought of is passing the object to the other modules through a predefined function.</p>
  
  <p>Main Module:</p>
  
  <pre><code>from mod1 import *
  from mod2 import *
  from Interfaces import *
  
  class MainClass():
      def __init__(self):
  
          # Initialize Modules
          self.m1 = Module1()
          self.m2 = Module2()
  
          self.intf = UdpInterface()
          self._init_module_interfaces()
  
      def _init_module_interfaces(self):
          self.m1.InitIntf(self.intf)
          self.m2.InitIntf(self.intf)
  
  if __name__ == '__main__':
      main = MainClass()
  </code></pre>
  
  <p>Submodule:</p>
  
  <pre><code>class Module1():
      def __init__(self):
          ...
  
      def InitIntf(self, intf):
          self.intf = intf
  </code></pre>
  
  <p>Is there a better way to do this?</p>