From 8c7c4df63ef7ed1cdad288cfa02f1c5b1f2de1e6 Mon Sep 17 00:00:00 2001 From: Toshi Aoyama Date: Wed, 19 Oct 2022 00:38:29 +0900 Subject: [PATCH] Prioritize extension's modle path With current implementation, module path for extension is appended by sys.append(). Some module like interactive need old module so we need to prioritize to import modules under extension's directory instead of default directory. This patch will fix problem like #24213 --- src/azure-cli-core/azure/cli/core/extension/operations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli-core/azure/cli/core/extension/operations.py b/src/azure-cli-core/azure/cli/core/extension/operations.py index db46f8938aa..4de0f31e8fd 100644 --- a/src/azure-cli-core/azure/cli/core/extension/operations.py +++ b/src/azure-cli-core/azure/cli/core/extension/operations.py @@ -501,7 +501,7 @@ def reload_extension(extension_name, extension_module=None): def add_extension_to_path(extension_name, ext_dir=None): ext_dir = ext_dir or get_extension(extension_name).path - sys.path.append(ext_dir) + sys.path.insert(0, ext_dir) # If this path update should have made a new "azure" module available, # extend the existing module with its path. This allows extensions to # include (or depend on) Azure SDK modules that are not yet part of