Reload Imported Modules
00:00 Reloading Imported Modules. You can use any code editor in conjunction with bpython to modify helper functions and classes defined in your local modules or packages and have them reloaded in the current REPL session on demand.
00:49 After saving your updated modules in a code editor, press F6 in bpython to reload them and reevaluate the complete session since starting the REPL. Reloading modules keeps existing instructions in the current REPL session intact and reruns them, resulting in updated outputs.
01:20 The bpython REPL also supports automatic module reloading so that you don’t have to manually hit a button every time you make a change to some code in an external editor. To take advantage of the auto-reload feature, you’ll have to install the external watchdog library as an optional dependency in the same virtual environment where you installed bpython.
01:50 Remember that whether you reload modules manually or let bpython do that automatically, it always triggers the complete session reevaluation. To enable the auto-reload feature, hit F5 while you’re in bpython.
Here you can see changes are being made to the
greet() function and the real-time changes in bpython as these changes are made. This is a dramatic improvement over manual module reloading, and it can save you a lot of time.
Become a Member to join the conversation.