Is there a straightforward way to find all the modules that are part of a python package? I’ve found this old discussion, which is not really conclusive, but I’d love to have a definite answer before I roll out my own solution based on os.listdir().
Share
Yes, you want something based on
pkgutilor similar — this way you can treat all packages alike regardless if they are in eggs or zips or so (where os.listdir won’t help).How to import them too? You can just use
__import__as normal: