0

In the settings.json I can set the python.autoComplete.extraPath but currently I have to hardcode my additional paths for the project. I know for pylint in VScode I can add these paths dynamically by executing code via the python.linting.pylintArgs with init-hook.

I was wondering if there is a way to execute code dynamically to change this?

1 Answer 1

1

Best option would be to write a script to update the settings.json file dynamically. Not sure if the setting changes to extraPaths are picked up dynamically post-launch, though.

Sign up to request clarification or add additional context in comments.

3 Comments

@BrettCannoon Python is able to import packages from the current directory, is there a way to add autocomplete paths the current opened script?
Python can import files from the same directory of a script is true. But that's only because when you execute a script you are telling Python that the directory the script is in is to be used as a top-level entry in sys.path. When you open a file in VS Code we don't' know where you consider the "top" to be. If you open the directory the script is in in VS Code as your workspace then it should work.
yes, your right @BrettCannon, however I though it could be a good idea to also include current directory, but maybe could cause more problems for beginners...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.