<Beginner Question> Python console cannot run updated function from script

Answered

I just started to learn Python so I thank all your patience with me in advance!

So I created a simple function a() in script called Sample.py and imported in the Python console. Then I called the function a() and I get the expected answer 1. 

However, after I let the a() function print 2 instead of 1 and imported the script again. The a() function still prints out 1. In order to make it right, I have to restart PyCharm. Could anyone please answer this silly question? It annoys me so much :( 

 

0
1 comment

Hi! You need to re-import your module (load it to interpreter again), just print: reload(Sample).

0

Please sign in to leave a comment.