diff --git a/zappa/cli.py b/zappa/cli.py index a89f9816a..b8f2abf4b 100755 --- a/zappa/cli.py +++ b/zappa/cli.py @@ -2141,7 +2141,7 @@ def callback(self, position): working_dir = os.getcwd() working_dir_importer = pkgutil.get_importer(working_dir) - module_ = working_dir_importer.find_module(mod_name).load_module(mod_name) + module_ = working_dir_importer.find_spec(mod_name).loader.load_module(mod_name) except (ImportError, AttributeError): try: # Callback func might be in virtualenv @@ -2844,7 +2844,7 @@ def execute_prebuild_script(self): working_dir = os.getcwd() working_dir_importer = pkgutil.get_importer(working_dir) - module_ = working_dir_importer.find_module(mod_name).load_module(mod_name) + module_ = working_dir_importer.find_spec(mod_name).loader.load_module(mod_name) except (ImportError, AttributeError): try: # Prebuild func might be in virtualenv