Sounds like you could use a lazy import.&nbsp; I do something similar to this in my factory:<br><br># protocol.py<br>class MyProtocol(XmlStream):<br>&nbsp;&nbsp;&nbsp; ....<br><br>class MyFactory:<br>&nbsp;&nbsp;&nbsp; def buildProtocol(self, addr):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; myProtocol = MyProtocol()
<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # heres the lazy import<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from othermodule import SomeKlass<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SomeKlass(myProtocol)<br><br>My `othermodule&#39; imports some constants from `protocol&#39; (module defined above).&nbsp; 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> &lt;<a href="mailto:redbaron@hitv.ru">redbaron@hitv.ru</a>&gt; 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.&nbsp;&nbsp;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>&quot;Government does not solve problems; it subsidizes them.&quot;<br>Ronald Reagan