Skip to content

Commit 7896127

Browse files
maiqbal11Hazhzeng
authored andcommitted
Reload additional modules that user might need (#539)
1 parent 88229d4 commit 7896127

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

azure_functions_worker/dispatcher.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -381,13 +381,15 @@ async def _handle__function_environment_reload_request(self, req):
381381
for var in env_vars:
382382
os.environ[var] = env_vars[var]
383383

384-
# Reload azure namespace for customer's libraries
385-
try:
386-
logger.info('Reloading azure module')
387-
importlib.reload(sys.modules['azure'])
388-
except Exception as ex:
389-
logger.info('Unable to reload azure: \n{}'.format(ex))
390-
logger.info('Reloaded azure module')
384+
# Reload package namespaces for customer's libraries
385+
packages_to_reload = ['azure', 'google']
386+
for p in packages_to_reload:
387+
try:
388+
logger.info(f'Reloading {p} module')
389+
importlib.reload(sys.modules[p])
390+
except Exception as ex:
391+
logger.info('Unable to reload {}: \n{}'.format(p, ex))
392+
logger.info(f'Reloaded {p} module')
391393

392394
# Reload azure.functions to give user package precedence
393395
logger.info('Reloading azure.functions module at %s',

0 commit comments

Comments
 (0)