Simple python question.
When in interactive mode, I'm test an imported file, let's say I use:
from foo import foo
But in the same time I edit the code. How can I update the script which is once loaded into interactive python? When I try to reimport it, nothing happens and I'm still on my old files.
Thanks for any help.
EDIT: Ok, as I understand reload(modulename) works fine, but... What if I'm trying to reload a class with its methods? As it's written in documentation:
If a module instantiates instances of a class, reloading the module that defines the class does not affect the method definitions of the instances — they continue to use the old class definition. The same is true for derived classes.
But there's no word how to update a class methods. Any idea?
The answer's here How to reload the code of a method of class object in Python?
No more question as everything works fine now :)
Did you take a look at this question? Reloading a changed python file in emacs python shell
Libraries in your python path can be easily updated with reload(modulename).
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