title: How to Deal with Redundant/Repeated Imports in Python Modules?
body: <p>I am writing a python module with multiple files, and files in sub-directories.</p>
  
  <p>For example, lets say the base directory is <code>./package</code>, sub-directory <code>./package/sub</code> and files <code>./package/sub/file1.py</code> and <code>./package/file2.py</code>.</p>
  
  <p>In <code>./package/sub/file1.py</code>, I imported the following third-party modules:</p>
  
  <pre><code>import pickle
  import numpy as np
  </code></pre>
  
  <p>In <code>./package/file2.py</code>, I imported the same modules from earlier, as well as the module present in the sub folder like so:</p>
  
  <pre><code>import pickle
  import numpy as np
  import sub.file1 as sub
  </code></pre>
  
  <p>Now, it turns out that <code>sub</code> has its own version of <code>pickle</code> under <code>sub.pickle</code>, and then file1 and file2 has their own version of pickle. Is there any way to remove this kind of redundancy? </p>
  
  <p>If it is not a problem, does anyone know if both pickle imports will refer to the same region of memory?</p>
  
  <p>Is there a better way I could have designed my code around imports?</p>