title: ModuleNotFoundError: No module named 'xxx.conf'; 'xxx' is not a package
body: <p>I have the following project structure:</p>
  
  <pre><code>xxx
  ├── xxx
  |   ├── settings
  |   └── tests
  |   └── __init__.py
  |   └── conf.py
  |   └── xxx.py
  |   └── utils.py
  </code></pre>
  
  <p>Those are the imports that I have in each file.</p>
  
  <p>xxx.py</p>
  
  <pre><code>from xxx import utils, conf
  from xxx.conf import BASE_DIR
  </code></pre>
  
  <p>conf.py</p>
  
  <pre><code>import os
  import yaml
  </code></pre>
  
  <p>utils.py</p>
  
  <pre><code>import os
  import shutil
  from typing import List, Optional, Tuple, Dict, Union
  import requests
  </code></pre>
  
  <p>When I run my app with</p>
  
  <pre><code>python3 xxx.py
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>ImportError: cannot import name 'utils' from 'xxx' (/Users/yyyyy/workscpace/xxx/xxx/xxx.py)
  </code></pre>
  
  <p>When I run my test suite with pytest, I don't get any errors.</p>
  
  <p>I have tried to change the import to (because those files are modules in my package):</p>
  
  <pre><code>import utils
  import conf
  </code></pre>
  
  <p>In this case, I can run my app with no errors but I get the following error when trying to run pytest</p>
  
  <pre><code>ModuleNotFoundError: No module named 'utils'
  </code></pre>
  
  <p>What am I doing wrong?</p>