title: import module with name same as built-in module in python 3
body: <p>I meet a similar problem which can be simplified as following:</p>
  
  <p>For example I have a file structure as following:</p>
  
  <pre><code>----folder
      ---- main.py
      ---- math.py
  </code></pre>
  
  <p>I define a function in <code>math.py</code> and I want to import this <code>math.py</code> in <code>main.py</code> .</p>
  
  <p>The codes in <code>math.py</code> is following</p>
  
  <pre><code># math.py
  def f(x) :
      return x**3
  </code></pre>
  
  <p>If I write codes in <code>main.py</code> as following</p>
  
  <pre><code># main.py
  import math
  
  def main() :
      print(math.f(3))
  
  if __name__ == "__main__":
      main()
  </code></pre>
  
  <p>then it returns <code>AttributeError: module 'math' has no attribute 'f'</code></p>
  
  <p>If I write codes in <code>main.py</code> as following</p>
  
  <pre><code># main.py
  from . import math
  
  def main() :
      print(math.f(3))
  
  if __name__ == "__main__":
      main()
  </code></pre>
  
  <p>Then it returns <code>ImportError: cannot import name 'math' from '__main__' (main.py)</code></p>
  
  <p>My question:</p>
  
  <ol>
  <li><p>If I <strong>only</strong> want to import the module <code>math.py</code> in path <code>folder</code> which has the same name as build-in module, what should I do?</p></li>
  <li><p>If in the <code>main.py</code> I want to use <strong>both</strong> <code>math.f(x)</code> defined in my <code>math.py</code> and built-in <code>math.acos(x)</code>, what should I do? </p></li>
  </ol>
  
  <p>PS: I meet similar problem since I have a long codes written by someone ten years ago. At that time there is no built-in module with such name (In fact it's not <code>math</code> module. I just simplify the problem by above question). And the functions of this module have been used at many places. Therefore it's almost impossible to change module's name since if so I need to carefully change all sites <code>module.function()</code>. </p>