Hot Code Reloading in Python


When it takes 2 hours to reload a notebook, then it is useful to be able to hot reload code. Learn how to do it. Then use the reloader decorator.

Upvotes: DownVotes:
Age: 2 years     Page Views: 1156
Votes / View: 0    Wilson Score: 0.00

He uses inspect to get the source code of a file.  He changes the file name, then next time he accesses that object, it reloads the code. Again uses inspect to get the module, creates a new locals, and does some more magic. 

So he now has an old locals, and a new locals, so he has to set the locals on the old class to be the new locals.