Back to all posts
python vscode programming jupyter

Exploring the VS Code Jupyter Interactive Window

2 min read (437 words)

So, if you’re into Python—like, coding or messing with data—you’ve probably played around with Jupyter Notebooks. They’re awesome for hacking away at stuff, plotting things out, or just throwing ideas together. But here’s the thing: what if you could get that same vibe inside Visual Studio Code, without ditching your .py files? That’s where the VS Code Jupyter Interactive Window comes in, and man, it’s a sneaky little feature I can’t get enough of.

What’s It All About?

Basically, this thing lets you run Python code bit by bit, like in a notebook, but right in a regular .py file. It’s like someone took the best parts of Jupyter and mashed them into VS Code. You can chunk your code into little “cells,” run them whenever, and see the results—charts, tables, whatever—pop up in this cool side window. No .ipynb mess to deal with, just your good ol’ script.

Here's the magic part: type #%% anywhere in your file. This creates what's called a "cell" – just like in Jupyter notebooks. Look for the tiny "Run Cell" play button that appears, or hit Shift+Enter. Watch as your code comes to life in the Interactive Window!

A Little Example

Say you’re messing with some data. Here’s what I’d scribble in a .py file:

#%% Load and prep some data
data = {
    "a": [1, 2, 3, 4],
    "x": [1, 2, 3, 4],
    "y": [10, 20, 25, 30],
    "z": [10, 20, 25, 30],
}

#%% Add another column
data["b"] = [5, 10, 15, 20]
data  # Just looking at our data structure

#%% Let's see what we've got
print(data)
VS Code interface showing Jupyter Interactive Window with Python code cells and output

Each #%% marks a new cell. I can run them one by one, tweak things if they don't look right, and immediately see the results. It's perfect for that experimental, iterative style of coding that data work often requires.

When I Reach for This Tool

  • Quick hacks or testing little code bits.
  • Digging into data and seeing results on the fly.
  • Sharing code with people—.py files are way easier to throw on Git than notebooks.

Don't get me wrong – regular Jupyter notebooks still have their place, especially for detailed documentation or when I need heavy markdown usage. But for my day-to-day coding and data exploration? The Interactive Window is my new best friend.

My Two Cents

Honestly, the VS Code Jupyter Interactive Window feels like cheating—it’s got Jupyter’s fun vibes but keeps things simple with a .py flow. It’s great when I just wanna mess around without firing up a whole notebook setup. If you haven’t tried it, give it a whirl. I’d bet it sticks in your toolbox.

Dmitry Golovach
About

Dmitry Golovach

Principal Network Engineer and AI enthusiast. Always learning, always building.

Share this post

All posts