hoh / reloadr

Hot code reloading tool for Python
GNU Lesser General Public License v3.0
529 stars 12 forks source link

How can I auto reload all the involved modules when the source is changed? #12

Open rudaoshi opened 3 years ago

rudaoshi commented 3 years ago

I want to auto reload all the involved modules when the source is changed.

How can I do this?

ArneBachmann commented 3 years ago

Yeah, I think this makes sense whenever I rename functions. I would simply put a @reload at my main function and wish it all works automatically. Module imports, on the other hand, are usually executed at import time once, not on function call.

In the end it's probably more sensible to write an external watcher that kills your process and respawns it whenever a file change has been detected (probably waiting a certain time or waiting for a file system flag).