Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 267641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T23:35:03+00:00 2026-05-11T23:35:03+00:00

I am using pdb to examine a script having called run -d in an

  • 0

I am using pdb to examine a script having called run -d in an ipython session.
It would be useful to be able to plot some of the variables but I need them in the main ipython environment in order to do that.

So what I am looking for is some way to make a variable available back in the main interactive session after I quit pdb. If you set a variable in the topmost frame it does seem to be there in the ipython session, but this doesn’t work for any frames further down.

Something like export in the following:

ipdb> myvar = [1,2,3]
ipdb> p myvar
[1, 2, 3]
ipdb> export myvar
ipdb> q

In [66]: myvar
Out[66]: [1, 2, 3]
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T23:35:04+00:00Added an answer on May 11, 2026 at 11:35 pm

    Per ipython’s docs, and also a run? command from the ipython prompt,

    after execution, the IPython
    interactive namespace gets
    updated with all variables defined in the program (except for __name__
    and sys.argv)

    By “defined in the program” (a slightly sloppy use of terms), it doesn’t mean “anywhere within any nested functions found there” — it means “in the globals() of the script/module you’re running. If you’re within any kind of nesting, globals()['myvar'] = [1,2,3] should still work fine, just like your hoped-for export would if it existed.

    Edit: If you’re in a different module, you need to set the name in the globals of your original one — after an import sys if needed, sys.modules["originalmodule"].myvar = [1, 2, 3] will do what you desire.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 188k
  • Answers 188k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You want to use the jQuery Forms Plugin. Its very… May 12, 2026 at 5:38 pm
  • Editorial Team
    Editorial Team added an answer Frameset DTD is not a 'superset' of transitional. It is… May 12, 2026 at 5:38 pm
  • Editorial Team
    Editorial Team added an answer You can try assigning the style to a variable. If… May 12, 2026 at 5:38 pm

Related Questions

I'm using pdb to debug Python programs and am unhappy with it's behaviour. I
I'm just starting out writing trying to write a simple program in C and
I'm using a library from CGAL which during the linking stage of my code
The question really says it all. For one project I am working on, the

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.