"re-importing" module while in Console doesn't update the code
Made a simple module in pycharm (fibonacci calculator).
Opened a console, 'import fibagain' (the module. Ran the function 'fib(3)' and got the expected result.
Then I make a minor change to the source code of the fib() function (change some print text).
Go back to the console and 'import fibagain'. Run 'fib(3)' alas it gives me the results from the first version of the program, not the revised version.
If I kill the console and start another, then importing and running 'fib(3') gives me the results from the revised source code.
Opened a console, 'import fibagain' (the module. Ran the function 'fib(3)' and got the expected result.
Then I make a minor change to the source code of the fib() function (change some print text).
Go back to the console and 'import fibagain'. Run 'fib(3)' alas it gives me the results from the first version of the program, not the revised version.
If I kill the console and start another, then importing and running 'fib(3') gives me the results from the revised source code.
请先登录再写评论。
![fibagain.py - pyTutorial - [~_PycharmProjects_pyTutorial]-2.jpg](http://adm-10980.intellij.net/zendesk-forum-storage/jf/pycharm/2112/fibagain.py%20-%20pyTutorial%20-%20%5B~_PycharmProjects_pyTutorial%5D-2.jpg)
In interactive Python session you should use to "reimport" module.
Please, see this doc.