Matt Williams wrote:
> Dear List,
> 
> I'm trying to clarify something about accessing variables.
> 
> If I have ONE.py file with some variable a, and ONE imports TWO, which
> has a variable b, can TWO access variable a (I don't think so, but I
> just thought I'd check).

You are right. TWO can import ONE to get access to ONE.a but circular imports 
are usually a bad idea and can cause subtle bugs.
> 
> I guess the way round this is just to make some classes & objects, and
> then they can easily pass parameters to each other, but I just thought
> I'd check.

That is a good solution. An alternative is to make a module THREE that both ONE 
and TWO import.

Kent

> 
> Matt  
> 
> _______________________________________________
> Tutor maillist  -  [email protected]
> http://mail.python.org/mailman/listinfo/tutor
> 
> 

_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to