title: Cannot set pythonpath environment variable from python
body: <p>I'm trying to debug a project that has a lot of additional libraries added to PYTHONPATH at runtime before launching the python file.</p>
  
  <p>I was not able to add those commands with <code>tasks.json</code> file prior to debugging python file in Visual Studio code (see post <a href="https://stackoverflow.com/questions/61239351/visual-studio-code-unable-to-set-env-variable-paths-prior-to-debugging-python-fi">Visual Studio Code unable to set env variable paths prior to debugging python file</a>), so I'm just adding them via an <code>os.system("..")</code> command</p>
  
  <p>I'm only showing 1 of the libraries added below:</p>
  
  <pre><code># Standard library imports
  import os
  import sys
  
  os.system("SET PYTHONPATH=D:\\project\\calibration\\pylibrary\\camera")
  
  # Pylibrary imports
  from camera import capture
  </code></pre>
  
  <p>When I debug, it fails on line <code>from camera import capture</code> with:</p>
  
  <pre><code>Exception has occurred: ModuleNotFoundError
  No module named 'camera'
    File "D:\project\main.py", line 12, in &lt;module&gt;
      from camera.capture import capture
  </code></pre>
  
  <p>I also tried </p>
  
  <p><code>os.environ['PYTHONPATH']="D:\\project\\pylibrary\\camera"</code> and I still get the same error</p>
  
  <p>Why is it not remembering the <code>pythonpath</code> while running the script?</p>
  
  <p>How else can I define the <code>pythonpath</code> while running Visual Studio Code and debugging the project file?</p>
  
  <p>I know I can add the <code>pythonpath</code> to env variables in windows, but it loads too many libraries and I want it to only remember the path while the python script is executed.</p>
  
  <p>Thanks</p>