>>Circular import does not work on module level, but you can
>>import the module in a method:
>>
>>file1.py:
>>import file2
>>....
>>
>>
>>file2.py:
>># import file1 # Does not work!
>>def foo():
>>    import file1 # Does work
> 
> 
> Cool idea !
> 
> It works on local namespaces, wich dont cause trouble to the whole program.
> 
> +1
Yes, I also think is a good solution. Once I needed to do something like
that and ended by writting a third module with the shared functions that
the two conflicting modules needed. At that time I already knew that one
could import modules from functions; however, I didn't come up with that
solution :-(

Regards,
Josef

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to