Scoping
Since Module
adds Temporal
attribute to your symbols, it is not clear when and how your dynamic symbols will be purged from the Kernel. Therefore use LeakyModule
to scope all dynamic symbols.
You can clean them up using ClearAll
after a notebook has been closed or cell has been destroyed. EventHandler
methods is applicable on ResultCell as well as EvaluationNotebook or even WindowObj.