[Python] How to run startup commands on loading Python Interactive window in VSCode

Discussão em 'Python' iniciado por Stack, Março 5, 2025.

  1. Stack

    Stack Membro Participativo

    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!

    Continue reading...

Compartilhe esta Página