From 2e7c8bbeec1592212c315172a427f2c5dab70de7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 1 Aug 2010 22:54:39 +0000 Subject: [PATCH] fix for py console autocomp. need to swap out __main__ module there too. --- release/scripts/op/console_python.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/release/scripts/op/console_python.py b/release/scripts/op/console_python.py index 2881e87fe00..70b24ddf2fa 100644 --- a/release/scripts/op/console_python.py +++ b/release/scripts/op/console_python.py @@ -205,6 +205,10 @@ def autocomplete(context): scrollback = "" scrollback_error = "" + if _BPY_MAIN_OWN: + main_mod_back = sys.modules["__main__"] + sys.modules["__main__"] = console._bpy_main_mod + try: current_line = sc.history[-1] line = current_line.line @@ -223,6 +227,9 @@ def autocomplete(context): import traceback scrollback_error = traceback.format_exc() + if _BPY_MAIN_OWN: + sys.modules["__main__"] = main_mod_back + # Separate automplete output by command prompts if scrollback != '': bpy.ops.console.scrollback_append(text=sc.prompt + current_line.line, type='INPUT')