Returning values from function to Python shell/IPython

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Karlo Lozovina

    Returning values from function to Python shell/IPython

    Hi all!

    I have a runTest() function inside my module, which sets up and initializes
    lots of objects and performs some basic tests on them. Usually (from
    IPython) I just write `run my_module.py`, and then `runTest()`. But
    sometimes I would like to manually twiddle with objects runTest creates. Is
    there any way I can "return" all those objects local to runTest(), and have
    them available in IPython (or ordinary Python shell)?

    Thanks...


    P.S.
    I know I can do it from a:

    if __name__ == '__main__':
    # lots of object initialization. ..

    and then have all those objects available in the interpreter.

    --
    Karlo Lozovina -- Mosor
Working...