How to dynamically/runtime load the module from python .egg and instantiate class? -
i have python package created using pydev in eclipse. instantiate class dynamically, provided module name string , using locate function pydoc, loaded module , instantiated class.now, want create python egg package , dynamically import module egg , instantiate class. how can extract module , instantiate class given have python egg in url/path.
below example of instantiating class providing module/class name string
from pydoc import locate my_class = locate('domain.module.submodule.myclass') my_instance = my_class()
now instead of module name string, want give path/url of python egg contains module , instantiate class.
Comments
Post a Comment