Importing

modulefinder — Find modules used by a script

Source code: Lib/modulefinder.py

Using importlib.metadata

importlib.metadata is a library that provides for access to installed package metadata. Built in part on Python’s import system, this library intends to replace similar functionality in the entry point API and metadata API of pkg_resources. Along with importlib.resources in Python 3.7 and newer (backported as importlib_resources for older versions of Python), this can eliminate the need to use the older and less efficient pkg_resources package.

importlib — The implementation of import

Source code: Lib/importlib/__init__.py

runpy — Locating and executing Python modules

Source code: Lib/runpy.py

pkgutil — Package extension utility

Source code: Lib/pkgutil.py

zipimport — Import modules from Zip archives

Source code: Lib/zipimport.py