Visual Studio Python Interactive Window can tremendously help you to run and quick executing of your python script. While using the python interactive window, you don’t need to worry about solutions or project types. The Interactive Window in Visual Studio is a great utility to play around with the code, language features, APIs, and other experimental features. It is a REPL (Read–eval–print-loop) that provides us with an environment for live coding and evaluating expression or code snippets based on our inputs. The Interactive Window also supports features like IntelliSense, syntax highlighting, and navigating through executed commands.
Visual Studio has great support so such as tooling interactive windows for programming languages such as C# and F#. If you are a developer with Python skill sets, you can also leverage the Python Interactive Windows for your coding experiment. This also allows us to execute a specific set of code for quick check out of the results.
Visual Studio Python Interactive Window
To launch the Interactive window navigate through Views > Other Windows > Python Interactive.
Now, Once the Interactive Window is Open, you can start writing your Python script and start executing it.
Here, noticed that you don’t need to be on a specific project or open a specific type of solution. This is a self-executable shell, and you can open it anytime.
Now, Once you have an interactive window running, you can start playing around with all python scripts and language features. It is as simple as this. You can choose a specific Module from the module drop down for the script execution.
Configuring the Environment
Visual Studio Python Interactive Window allows us to configure the environments. You can choose the configured environment from the “Environment” dropdown. To configure a new Environment or change an existing environment, navigate through Views > Other Windows > Python Environments
Python Environments is a global setup for your Visual Studio. Here you can see the list of installed versions, along with it will let us allow to “Add environment” as well.
To install any packages or modules, you need to switch Packages from Overview, where you can search and install any packages that you want to install for the environment.
well, to summarize, the Interactive window is for quick prototyping, checking some quick output of python code without creating some new projects. This is really great utility available with Visual Studio and can help us to do a quick code experiment. !