title: Python globally import in a for loop (preferrably Python 3.x)
body: <p>My code is this:</p>
  
  <pre><code>for module in ["ffmpy","os","sys"]:
      try:
          __import__(module)
      except:
          print("Can't import ["+module+"]")
  </code></pre>
  
  <p>So, I want to import this globally, but it doesn't seem to do this. After this code, I have <code>sys.path.insert(0, r"C:\Users\david\Desktop\scripts")</code>,and the python console tells me: <code>NameError: name 'sys' is not defined</code>. I don't know what I'm doing wrong, but you hopefully do.</p>
  
  <p>edit: This Question is not a duplicate, because i don't 'just' want to import from string, but do that from a for loop. I basically want to import from a string, in a loop, globally.</p>