title: Using Two Python Libraries with Conflicting Names
body: <p>I want to use two Python libraries (Google's <a href="https://github.com/GoogleCloudPlatform/google-cloud-python" rel="noreferrer">Cloud Library</a>, and their <a href="https://cloud.google.com/appengine/docs/python/download" rel="noreferrer">Cloud SDK</a>) in a single application, but they have conflicting names (they both use <code>google</code> in their base import names and do not use relative imports internally). How can I use them in a single app?</p>
  <p>Changing the library's code to use proper relative imports is not practical. Also, I know I can use virtualenv to access these libraries from separate python applications, but how do I access them from within the same python app?</p>
  <h3>Details of the Naming Conflict</h3>
  <p>Here are some of the details on the import. When I import a module from the Cloud Library (I run <code>import google.cloud.datastore</code>), there is an exception about another import within that library:</p>
  <pre><code>&gt;&gt;&gt; import libs.google.cloud.datastore
  Traceback (most recent call last):
    File &quot;&lt;console&gt;&quot;, line 1, in &lt;module&gt;
    File &quot;C:\[ProjectDIR]\libs\google\cloud\datastore\__init__.py&quot;, line 52, in &lt;module&gt;
      from google.cloud.datastore.batch import Batch
  ImportError: No module named cloud.datastore.batch
  </code></pre>
  <p>The library is trying to do an absolute import, rather than a relative one. The reason that the Google Cloud Library cannot import <code>google.cloud.datastore.batch</code> is because <code>google</code> is already defined in the SDK, there is a naming conflict:</p>
  <pre><code>&gt;&gt;&gt; print google.__path__
  ['C:\\Program Files (x86)\\Google\\Cloud SDK\\google-cloud-sdk\\platform\\google_appengine\\google']
  </code></pre>
  <p>Because the Cloud Library uses absolute imports, and the name <code>google</code> is already defined in the SDK, then the import fails.</p>