Lets say that I have a python package and I want to list out all the modules within this package. i.e.
>>> import my_package
>>> import inspect
>>> inspect.getmembers(my_package, inspect.ismodule)
>>> []
For some reason I am getting an empty list. Now if I manually load a module from the package then:
>>> import my_package.module_a
>>> inspect.getmembers(my_package, inspect.ismodule)
>>> ['module_a, <module '....'>]
Assuming that I have multiple modules and I don't want to load them one by one is there any other way to do it? (p.s. from my_package import * won't work).
Furthermore do you know what is causing this behavior? Is anything that has to do with namespaces?
P.S Packages are not locally installed, I am loading everything from a server.
my_package.module_abefore the second import?