There is code in a proprietary library (e.g. below, called foo.bar
) that I use which loads modules at runtime like this:
module_name = f"foo.bar.{some_module}"
module = importlib.import_module(module_name)
The user supplies the name of a module in some text config and that module is loaded by the library.
I want to supply some modules which add additional functionality, so I'd like to write a separate library to add further modules to the foo.bar
package and bundle these up for distribution via an internal PyPi.
So someone would run pip install foo mylibrary
and this would install the foo
and the mylibrary
libraries, but I want the classes inside mylibrary
to also appear inside the foo.bar
namespace.
Is this possible please?