I have created a module of functions in the form of a separate module.py file. I make updates to the functions in the module as I develop my code. However, when I go back to the run file (main) to call the updated functions, the updates have not been picked up (i.e., the run file calls the old version of the function), and often aren't picked up unless I re-start PyCharm.
I have tried:
Saving the module.py file, then reimporting it in the run file before calling functions from it
Clearing the console using Rerun (green curved arrow in console) before re-running the script
Adding a 'reload(module)' statement in before the function call in the run file
(For the avoidance of doubt, the import statement for the module is in the run file and works the first time I call it. It just doesn't efficiently pull through updates when I reimport it).
Note: JetBrains support have since suggested the following as a solution.
"First of all, if you're using version 2020.1, I suggest updating to 2020.2, and then check File | Settings | Appearance & Behavior | System Settings | Autosave settings to make sure the changes are saved. If this doesn't help and the issue is still reproduced in PyCharm, please try running your code from the terminal outside of IDE, and check if the behavior is the same."
I can't update to the new version yet to test it (some of my critical plugins are incompatible), but this may be useful for others. In the meantime, clearing the console in between each run using Rerun (curved green arrow) seems to be working now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With