Charles Reich
Charles Reich

Reputation:

How can I make a change to a module without restarting python interpreter?

I am testing code in the python interpreter and editing in a separate window. I currently need to restart python whenever I make a change to the module I am testing.

Is there an easier way to do this?

Thanks,

Charlie

Upvotes: 1

Views: 1226

Answers (3)

codeape
codeape

Reputation: 100766

Have a look at IPython http://ipython.scipy.org. It has various features that make working with Python code interactively easier.

Some screenshots and tips.

Upvotes: 1

acrosman
acrosman

Reputation: 12900

It sounds like you want to reload the module, for which there is a built-in function reload(module). That said, when I looked it up just now (to make sure I had my reference right, Google returned a couple of discussions (granted they are several years old) pointing out problems using reload(). You might want to review those if reload() causes you headaches.

Upvotes: 3

avakar
avakar

Reputation: 32635

The built-in function reload is what you're looking for.

Upvotes: 10

Related Questions