title: In Python, how to automatically import all nested packages without namespace override?
body: <p>I have a 2-layer package:</p>
  
  <pre><code>package1
  |--package2
  |  |--function1
  |  |--function2
  |--package3
  </code></pre>
  
  <p>I'm trying to avoid name/import conflict as much as possible, so I import all members in a package without changing there namespaces, then use the functions by their full name:</p>
  
  <pre><code>import package1 as package1
  
  package1.package2.function1(...)
  </code></pre>
  
  <p>However, the interpreter gave me the following error:</p>
  
  <pre><code>  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  AttributeError: 'module' object has no attribute 'package2'
  </code></pre>
  
  <p>This seems to be illogical since package2 is definitely in the namespace of package1, which I have already imported. If I would like to keep using my function call format, what kind of import should I use WITHOUT referring to package2 and package3?</p>
  
  <p>I've also tried the following:</p>
  
  <pre><code>import package1.*               (doesn't work)
  from package1 import * as package1.* (obviously doesn't work)
  from package1 import *          (works but bad practice, causes naming conflict)
  </code></pre>
  
  <p>But non of them fulfils my need.</p>