Circular Inheritance
Michele Simionato
mis6 at pitt.edu
Wed Jul 2 10:23:05 EDT 2003
jinal jhaveri <jhaveri at usc.edu> wrote in message news:<mailman.1057099023.14043.python-list at python.org>...
> Hi All,
>
> I have one question regarding circular inheritance
>
> I have 3 files
>
> 1) A.py , having module A and some other modules
> 2) B.py having module B and some other modules
> 3) C.py having module C and some other modules
>
> Now I want to import Module C in B.py
>
> but C requires A.py
> and A requires B.py
>
> so
>
> B requires C
> C requires A
> A requires B
>
> and when I try to do this using
>
> from ...import....
> it tells me that you cannot import this.
>
> So any suggestions on this?
>
> thank you
> Jinal
In theses circumstances, I find useful the "execfile" built-in.
With "execfile" you can split a big module with internal references
in various files. For instance you could split your module in three
files and do something like
#module M
execfile('M1.py')
execfile('M2.py')
execfile('M3.py')
Michele
More information about the Python-list
mailing list