简体   繁体   中英

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

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.

You need to do:

reload(functions)

And then:

from functions import myfunc

Thanks to Nobilis for the correction.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM