Skip to content

Commit 72e41db

Browse files
authored
FIX: import_module() reloads submods recursively to work with --http and __all__ (#300)
1 parent 1dbb782 commit 72e41db

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

pdoc/__init__.py

+4
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,10 @@ def _module_path(module):
230230
# `isinstance(..., pdoc.Doc)` calls won't work correctly.
231231
if reload and not module.__name__.startswith(__name__):
232232
module = importlib.reload(module)
233+
# We recursively reload all submodules, in case __all_ is used - cf. issue #264
234+
for mod_key, mod in list(sys.modules.items()):
235+
if mod_key.startswith(module.__name__):
236+
importlib.reload(mod)
233237
return module
234238

235239

pdoc/cli.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def html(self):
265265
"""
266266
return pdoc.html(self.import_path_from_req_url,
267267
reload=True, http_server=True, external_links=True,
268-
skip_errors=args.skip_errors,
268+
skip_errors=self.args.skip_errors,
269269
**self.template_config)
270270

271271
def resolve_ext(self, import_path):

0 commit comments

Comments
 (0)