python - How do you get all classes defined in a module but not imported? -


i've seen following question doesn't quite me want: how can list of classes within current module in python?

in particular, not want classes imported, e.g. if had following module:

from my.namespace import mybaseclass somewhere.else import someotherclass  class newclass(mybaseclass):     pass  class anotherclass(mybaseclass):     pass  class yetanotherclass(mybaseclass):     pass 

if use clsmembers = inspect.getmembers(sys.modules[__name__], inspect.isclass) accepted answer in linked question suggests, return mybaseclass , someotherclass in addition 3 defined in module.

how can newclass, anotherclass , yetanotherclass?

inspect __module__ attribute of class find out module defined in.


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -