"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.  
fibagain.py - pyTutorial - [~_PycharmProjects_pyTutorial]-2.jpg
1 comment
Hi, karastack.

In interactive Python session you should use
reload(fibagain)
prettyPrint(); to "reimport" module.
Please, see this doc.
0

Please sign in to leave a comment.