summaryrefslogtreecommitdiff
path: root/cmd2/cmd2.py
diff options
context:
space:
mode:
Diffstat (limited to 'cmd2/cmd2.py')
-rwxr-xr-xcmd2/cmd2.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index 8d8a5b07..4437426e 100755
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -2877,13 +2877,13 @@ Usage: Usage: unalias [-a] name [name ...]
Non-python commands can be issued with ``cmd("your command")``.
Run python code from external script files with ``run("script.py")``
"""
+ from .pyscript_bridge import PyscriptBridge
if self._in_py:
self.perror("Recursively entering interactive Python consoles is not allowed.", traceback_war=False)
return
self._in_py = True
try:
- self.pystate['self'] = self
arg = arg.strip()
# Support the run command even if called prior to invoking an interactive interpreter
@@ -2906,8 +2906,11 @@ Usage: Usage: unalias [-a] name [name ...]
"""
return self.onecmd_plus_hooks(cmd_plus_args + '\n')
+ bridge = PyscriptBridge(self)
+ self.pystate['self'] = bridge
self.pystate['run'] = run
- self.pystate['cmd'] = onecmd_plus_hooks
+ self.pystate['cmd'] = bridge
+ self.pystate['app'] = bridge
localvars = (self.locals_in_py and self.pystate) or {}
interp = InteractiveConsole(locals=localvars)