2 class with same name in different module

Fredrik Lundh fredrik at pythonware.com
Wed Oct 5 09:58:04 CEST 2005

"Iyer, Prasad C" wrote:

> I have a class in a module which is getting imported in main module.
> How do you differentiate between the 2 class

if you have one class in a module, why do you need to differentiate
between it?  assuming that you do in fact have *two* classes with
the same name in two different modules, you just have to import them
as usual, and access them via their modules:

    import module1
    import module2

    o1 = module1.Class()
    o2 = module2.Class()

if this is not what you mean, please post a short example that shows
what the problem really is.


More information about the Python-list mailing list