title: Good practice sharing resources between modules?
body: <p>I am reorganizing my code and therefore creating new namespaces. I'm changing "static" classes (classes with @staticmethod in each method) for modules. This is the way to go, right?</p>
  
  <p>The problem is that I have doubts on how to share the resources between these modules.</p>
  
  <p>Let's say I had a module from which I was doing all connections to database, and of course all classes/methods were sharing the variable which stored the DB cursor (I'm using SQLite). Now, in different modules, they also have to share the cursor.</p>
  
  <p><img src="https://i.stack.imgur.com/Qmxl1.png" alt="Graphical representation of dependences"></p>
  
  <p>So, my ideas:</p>
  
  <ul>
  <li><p>Declare the global variable in each module. But globals are evil, eat children and steal our jobs. So I don't know if this is the way to go.</p>
  
  <pre><code>'''Sub Module 1'''
  
  global database_cursor
  </code></pre></li>
  <li><p>Import the "father" database_module with the original database_cursor and use something like this:</p>
  
  <pre><code>'''Sub Module 1'''
  
  db_cursor = database_module.database_cursor
  </code></pre></li>
  </ul>
  
  <p>This second looks fine in this case, but I think in many cases will lead to recursive imports, which I guess it´s something to avoid.</p>