title: Import Local module over global python
body: <p>I have a 2 python files. One is trying to import the second. My problem is that the second is named math.py. I can not rename it. When I attempt to call a function that is located inside math.py, I can not because I end up with the global math module. How would I import my local file instead of the global. I am using Python 2.7, and this is(roughly) my import statment:</p>
  
  <pre><code>cstr = "math"
  command = __import__(cstr)
  </code></pre>
  
  <p>Later I try:</p>
  
  <pre><code>command.in_math_py_not_global()
  </code></pre>
  
  <p><strong>Edit:</strong> a more complete example:</p>
  
  <pre><code>def parse(self,string):
      clist = string.split(" ")
      cstr= clist[0]
      args = clist[1:len(clist)]
      rvals = []
      try:
          command = __import__(cstr)
          try:
              rvals.extend(command.main(args))
          except:
              print sys.exc_info()
      except ImportError:
          print "Command not valid"
  </code></pre>