Chris Angelico <ros...@gmail.com> writes: > On Tue, Aug 17, 2021 at 4:02 AM Greg Ewing > <greg.ew...@canterbury.ac.nz> wrote: >> The second best way would be to not use import_module, but to >> exec() the student's code. That way you don't create an entry in >> sys.modules and don't have to worry about somehow unloading the >> module. > > I would agree with this. If you need to mess around with modules and > you don't want them to be cached, avoid the normal "import" mechanism, > and just exec yourself a module's worth of code.
Sounds like a plan. Busy, haven't been able to try it out. But I will. Soon. Thank you! -- https://mail.python.org/mailman/listinfo/python-list