title: Understanding differences in imports when running locally vs installing from PyPI
body: <p>I have created a package which has the following structure:</p>
  
  <pre><code>/data_worker/
      .git/
      data_worker/
          wrappers/
              alpha_vantage_wrapper.py
              quandl_wrapper.py
              wrapper.py
          __init__.py
          data_worker.py
          defined_wrappers.py
          mapper.py
      tests/
          test.py
      .gitignore
      LICENSE
      README.md
      requirements.txt
      setup.py
      test.py
  </code></pre>
  
  <p><code>/data_worker/data_worker/data_worker.py</code> begins with the following lines:</p>
  
  <pre><code>from defined_wrappers import wrappers
  import mapper
  
  import pandas as pd
  import json
  import os
  
  DATA_WORKER_DIR = os.path.dirname(os.path.abspath(__file__)) + '/'
  
  
  class DataWorker:
      ...
  </code></pre>
  
  <p>In <code>/tests/test.py</code>, I am testing running the package from a completely separate directory, as it would be done once I <code>pip install</code> the package.
  I have the following:</p>
  
  <pre><code>from data_worker.data_worker import DataWorker
  
  dw = DataWorker()
  </code></pre>
  
  <p>which runs fine with the following error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/home/kevin/Documents/data_worker/tests/test.py", line 1, in &lt;module&gt;
      from data_worker.data_worker import DataWorker
    File "/usr/local/lib/python3.6/dist-packages/data_worker/data_worker.py", line 1, in &lt;module&gt;
      from defined_wrappers import wrappers
  ModuleNotFoundError: No module named 'defined_wrappers'
  </code></pre>
  
  <p>So my question is:</p>
  
  <p>How can I structure my project's imports so that it can be run without errors after installing from PyPI (or from my <code>tests</code> directory)?</p>