title: Why doesn't module import while it actually exists?
body: <p>My project structure looks like the following:</p>
  
  <pre><code>my-project:
     dialog
       utils
         path.py
  </code></pre>
  
  <p>After install by 'pip install .', in PyCharm, I can import successfully either of the two:</p>
  
  <pre><code>from dialog.utils import path
  import dialog.utils
  </code></pre>
  
  <p>Then I can refer to it as below:</p>
  
  <pre><code> path.module_path() // OR
   dialog.utils.module_path()
  </code></pre>
  
  <p>It doesn't run into any problem. I can also do this in iPython's terminal. However, when I run a python through terminal:</p>
  
  <pre><code>python3 run_dialog
  </code></pre>
  
  <p>run_dialog.py import 'path' as shown above, it always reports this problem:</p>
  
  <pre><code>Traceback (most recent call last):
    File "run_dialog.py", line 15, in &lt;module&gt;
      import dialog.utils
  ModuleNotFoundError: No module named 'dialog.utils'
  </code></pre>
  
  <p>So basically, I can run this code in both PyCharm and iPython terminal, but not in the project with 'python3 run_dialog'.</p>
  
  <p>Why is that?</p>