5

I'm trying to execute some startup commands before starting or resetting the Python Interactive Window (IPython) within VSCode. As I have been check in the documentation and in the parameters settings, I was able to identify the correct parameter:

Python > Data Science: Run Startup Commands

A series of Python instructions or iPython magic commands separated by '\n' that will be executed when the interactive window loads. For instance, set this to '%load_ext autoreload\n%autoreload 2' to automatically reload changes made to imported files without having to restart the interactive session.

However, when I insert my desirable python commands they not work as expected. As an example I tried to load the numpy package inserting 'import numpy as np', but when I start a new Python Interactive Window it outputs:

np is not defined

What I'm doing wrong? Thank you!

1
  • 1
    This option is now moved to Jupyter>Run Startup Commands as of VSCode 1.74.0.
    – Brainor
    Dec 13, 2022 at 8:17

1 Answer 1

0

Remove the quotes '', just import numpy as np and don't forget to separate instructions with \n.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.