Sounds like you could use a lazy import. I do something similar to this in my factory:<br><br># protocol.py<br>class MyProtocol(XmlStream):<br> ....<br><br>class MyFactory:<br> def buildProtocol(self, addr):<br> myProtocol = MyProtocol()
<br><br> # heres the lazy import<br> from othermodule import SomeKlass<br> SomeKlass(myProtocol)<br><br>My `othermodule' imports some constants from `protocol' (module defined above). So, to kill the circular references, I do a lazy import in MyFactory.
<br><br>HTH!<br>jw<br><br><div><span class="gmail_quote">On 7/1/07, <b class="gmail_sendername">Ivanov Maxim</b> <<a href="mailto:redbaron@hitv.ru">redbaron@hitv.ru</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Some of my logic need protocol to be imoported to be able to send data back.<br><br>So when I start app protocol imports my logic (where all data is processed)<br>and my logic imports protocol. Right now I simply pass protocol object as
<br>argument to constructors, but it seems to be not the best way from my point<br>of view. How to solve this problem?<br><br>_______________________________________________<br>Twisted-Python mailing list<br><a href="mailto:Twisted-Python@twistedmatrix.com">
Twisted-Python@twistedmatrix.com</a><br><a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br></blockquote></div><br><br clear="all">
<br>-- <br>"Government does not solve problems; it subsidizes them."<br>Ronald Reagan