title: Allow statements before imports with Visual Studio Code and autopep8
body: <p>I'm using Visual Studio Code with the Python plugin and autopep8 with:</p>
  <pre><code>&quot;editor.formatOnSave&quot;: true
  </code></pre>
  <p>I have local packages I need to import, so I have something like:</p>
  <pre><code>import sys
  sys.path.insert(0, '/path/to/packages')
  import localpackage
  </code></pre>
  <p>but when I save, Visual Studio Code/autopep8 moves all import statements before the code, so Python can't find my local package.</p>
  <pre><code>import sys
  import localpackage
  sys.path.insert(0, '/path/to/packages')
  </code></pre>
  <p>How can I tell Visual Studio Code/autopep8 that it's okay to put a statement before imports, or is there a more correct way of importing local packages?</p>
  <p>As a workaround, it looks like it's fine if you import in an <em>if</em> statement:</p>
  <pre><code>import sys
  
  sys.path.insert(0, '/path/to/packages')
  if 'localpackage' not in sys.modules:
      import localpackage
  </code></pre>