Bubble
Bubble

Reputation: 63

Python console doesn't get updated (with PyCharm)

I am new at Python, and I am using PyCharm. I have trying to use the console to interactively check what my functions do, but once the functions have been loaded, they don't get updated. More precisely :

Given a set of functions in "functions.py", I write in the the console "from functions import *" This works at first, but when the functions in "functions.py" are changed, the console doesn't see it, even if I relauch the "import" command.

Any idea of what I shoud do?

Thanks

Upvotes: 2

Views: 1486

Answers (2)

xXliolauXx
xXliolauXx

Reputation: 1313

You need to do:

reload(functions)

And then:

from functions import myfunc

Thanks to Nobilis for the correction.

Upvotes: 0

Nobilis
Nobilis

Reputation: 7448

Reload your module by doing reload(functions).

Then do the from functions import * one more time (as you're importing everything).

Then it will work.

Alternatively, if you're importing just the module:

import functions 

and calling it from the module namespace:

functions.my_function()

then only reload(functions) is sufficient (no need to call import again).

I've tested all of that on Python 2.7.6 in an interpreter session.

Upvotes: 1

Related Questions