<html><body>On 08:42 am, sven-erik.tiberg@ltu.se wrote:<br /><br />&gt;Don't know how to access objects from the main module in the classes in<br />&gt;the lib module.<br />&gt;The tricky part as I see it are ( part of from transive_UDP.py ):<br />&gt;# ------------------------------------------------------------------<br />&gt; def datagramRecived(self, data):<br />&gt; &#160; &#160; &#160; &#160;count = 0<br />&gt; &#160; &#160; &#160; &#160;data_str = string.split(data)<br />&gt; &#160; &#160; &#160; &#160;for recive_items in data_str:<br />&gt; &#160; &#160; &#160; &#160; &#160; &#160;__main__.recived_data[ count ] = float( recive_items )<br />&gt; &#160; &#160; &#160; &#160; &#160; &#160;count = count +1<br />&gt; &#160; &#160; &#160; &#160;__main__.update_on_recive()<br />&gt;<br />&gt;#-----------------------------------------------------------------<br />&gt;The problems are that I need to update __main__.recive.dada before<br />&gt;calling __main__.updat_on_recive().<br /><br />There is no Twisted API or special technique that you need to use. &#160;Just create your objects with references to all the objects they need to manipulate.<br /><br />For example, in main.py, instead of:<br /><br />&#160; &#160; reactor.listenUDP(self.port, transive_udp('...',2345, 0.05 ))<br /><br />just do:<br /><br />&#160; &#160; reactor.listenUDP(self.port, transive_udp('...', 2345, 0.05, recive_data))<br /><br />and then add an argument to transive_udp's constructor to refer to the data.<br /><br />&gt;Second how to access the &#160;.send_UDP from the __main__ module.<br /><br />Similarly, you can keep a reference to transive_udp object in the main module.<br /><br />I might be able to comment more except the attached example is full of errors and will not even import.<br /></body></html>