Python Interactive Window in Visual Studio

Python Interactive Window in Visual Studio

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 IntelliSensesyntax 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.

Python Interactive Window

Now, Once the Interactive Window is Open, you can start writing your Python script and start executing it.

Execute Python Code in Interactive Window
Execute Python Code in Interactive Window

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.

Selecting Module for Python Interactive Window
Selecting Module for Python Interactive Window

Use C# Interactive Window for your coding experiment in Visual Studio.

Execute in Interactive”– Send to C# Interactive Window 

tips and trics – C# interactive window in visual studio

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

Configuring Environment for Visual Studio Python Interactive Window

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.

Add New Environment for Visual Studio Python Interactive Window

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.

 Environment Settings for Visual Studio Python Interactive Window

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. !

Abhijit Jana

Abhijit runs the Daily .NET Tips. He started this site with a vision to have a single knowledge base of .NET tips and tricks and share post that can quickly help any developers . He is a Former Microsoft ASP.NET MVP, CodeProject MVP, Mentor, Speaker, Author, Technology Evangelist and presently working as a .NET Consultant. He blogs at http://abhijitjana.net , you can follow him @AbhijitJana . He is the author of book Kinect for Windows SDK Programming Guide.

3 Comments to “Python Interactive Window in Visual Studio”

Comments are closed.