From 80260824c65512edc3f60aa7eb8fead9818b1a90 Mon Sep 17 00:00:00 2001 From: Andrew Hlynskyi Date: Mon, 12 Sep 2016 00:43:58 +0300 Subject: [PATCH] Fix completion in `scrapy shell` for new imports --- scrapy/utils/console.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scrapy/utils/console.py b/scrapy/utils/console.py index a712df30e..567fd51bc 100644 --- a/scrapy/utils/console.py +++ b/scrapy/utils/console.py @@ -13,7 +13,9 @@ def _embed_ipython_shell(namespace={}, banner=''): @wraps(_embed_ipython_shell) def wrapper(namespace=namespace, banner=''): config = load_default_config() - shell = InteractiveShellEmbed( + # Always use .instace() to ensure _instance propagation to all parents + # this is needed for completion works well for new imports + shell = InteractiveShellEmbed.instance( banner1=banner, user_ns=namespace, config=config) shell() return wrapper