title: How to import from other scripts in VSCode?
body: <p>I created the following two scripts in a brand new empty folder called <code>F:\python\hello_world</code>, using <em>Visual Studio Code</em>:</p>
  <p>The first is <code>my_function.py</code>:</p>
  <pre><code>def hello() -&gt; str:
      return &quot;Hello, World&quot;
  </code></pre>
  <p>The second is <code>my_app.py</code>:</p>
  <pre><code>from my_function import hello
  
  print(hello())
  </code></pre>
  <p>When I run this from Visual Studio Code, I get an error saying I can't import:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;f:/python/hello_world/my_app.py&quot;, line 1, in &lt;module&gt;
      from my_function import hello
  ImportError: cannot import name 'hello' from 'my_function' (f:\python\hello_world\my_function.py)
  </code></pre>
  <p>Any clue? I've recently switched from using PyCharm to using VSCode, and I can't quite seem to get started...</p>
  <h2>New Development</h2>
  <p>It turns out that, unlike my toy example (which works fine as soon as I add <code>__init__.py</code> to the project's folder), I was trying to run code from within a subfolder of the project. That's a VSCode no-no.</p>