noob: reloading modified python file within Python Shell

J

johnny

from people.models import *

Now I make changes to the models.py. How do I reload this module in
Python Shell?
 
D

Diez B. Roggisch

johnny said:
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
 
R

Robert Kern

johnny said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top