title: how to test if one python module has been imported?
body: <p>How to test if a module has been imported in python?</p>
  
  <p>for example I need the basics:</p>
  
  <pre><code>if not has_imported("sys"):
     import sys
  </code></pre>
  
  <p>also</p>
  
  <pre><code>if not has_imported("sys.path"): 
     from sys import path
  </code></pre>
  
  <p>Thanks!</p>
  
  <p>Rgs.</p>
  
  <p>Thanks for all of your comments:
  the code been pasted here.
  <a href="https://stackoverflow.com/questions/5037468/auto-import-all-sub-modules-in-a-folder-then-invoke-same-name-functions-python">auto import all sub modules in a folder then invoke same name functions - python runtime inspect related</a></p>