title: How do I import modules from an array in python?
body: <p>Im trying to import a set of modules that are defined by an array. The reason I would like to store them in an array is because I would like to change this list dynamically.</p>
  
  <pre><code>moduleNames = ['sys', 'os']
  import moduleNames
  </code></pre>
  
  <p>However this doesnt work.</p>
  
  <p>I have searched around and found this:</p>
  
  <pre><code>moduleNames = ['sys', 'os']
  modules = map(__inport__, moduleNames)
  </code></pre>
  
  <p>This imports the modules however I would like to be able to access it by doing <code>sys.version</code> for example. Rather than by using <code>modules[0].version</code></p>
  
  <p>Is this currently possible I can't seem to find anywhere that shows you how to do it.</p>