noob: reloading modified python file within Python Shell

Discussion in 'Python' started by johnny, Sep 10, 2007.

  1. johnny

    johnny Guest

    from people.models import *

    Now I make changes to the models.py. How do I reload this module in
    Python Shell?
    johnny, Sep 10, 2007
    #1
    1. Advertising

  2. johnny schrieb:
    > from people.models import *
    >
    > Now I make changes to the models.py. How do I reload this module in
    > Python Shell?
    >


    reload(module)

    which works only with

    import people.models

    reload(people.models)

    Which is better anyway, as the

    from module import *

    syntax will create local names that won't be changed by the reload.

    Diez
    Diez B. Roggisch, Sep 10, 2007
    #2
    1. Advertising

  3. johnny

    Robert Kern Guest

    johnny wrote:
    > from people.models import *
    >
    > Now I make changes to the models.py. How do I reload this module in
    > Python Shell?


    import people.models
    reload(people.models)
    from people.models import *

    --
    Robert Kern

    "I have come to believe that the whole world is an enigma, a harmless enigma
    that is made terrible by our own mad attempt to interpret it as though it had
    an underlying truth."
    -- Umberto Eco
    Robert Kern, Sep 10, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. TB
    Replies:
    2
    Views:
    4,151
  2. Christian Heimes
    Replies:
    0
    Views:
    585
    Christian Heimes
    Feb 27, 2008
  3. Gerardo Herzig
    Replies:
    1
    Views:
    1,059
    Philipp Pagel
    Feb 27, 2008
  4. Gustavo
    Replies:
    0
    Views:
    85
    Gustavo
    Aug 25, 2003
  5. Replies:
    4
    Views:
    113
    Tintin
    Dec 4, 2004
Loading...

Share This Page