List submodules of a python module
21:06 27 Dec 2017

How to get the name/list of all submodules of an already imported Python module? (Not the external imported module/packages, just that one in the same folder as module sub-folder).

I am using

import inspect
print([o[0] for o in inspect.getmembers(module_imported) if inspect.ismodule(o[1])])

but this print also the system modules imported and files in the main module folder.

python module