Add `clear` function to the REPL functions
@@ -41,7 +41,7 @@ def __runREPL__():
if "widget" in os.environ:
return
- __namespace__ = {}
+ __namespace__ = {"clear":clear}
def read(prompt):
import console
@@ -88,8 +88,13 @@ def __clear_mods__():
pass
try:
- del sys.modules["_values"]
- except KeyError:
+ _values = sys.modules["_values"]
+
+ for attr in dir(_values):
+ if attr not in _values._dir:
+ delattr(_values, attr)
+
+ except:
pass
try:
