[Bf-python] Text buffers updating

Stephen Swaney sswaney at centurytel.net
Tue May 3 13:33:30 CEST 2005


On Tue, May 03, 2005 at 12:34:29PM +0200, Carlos López wrote:

> Mmm... Good idea, but it doesn´t work. I'm using 2 scripts: one is a 
> GUI, which makes the configuration buffer: a list of variables. The 
> other is a change-frame linked ("main") to a scene. The config buffer 
> automatic edition works well, but the the main loads always the first 
> buffer loaded (via "import buffer", then using "buffer.variable"), any 
> posterior edition works.
> 
> Getting the point:
> Write a buffer assigning variables, and name it "config.py", p.e:
>     a = [1,3]
>     x = 4
> Write another buffer:
>     import config
>     print dir(config)
> Execute it, the you get:
>     ['__builtins__', '__doc__', '__file__', '__name__', 'a', 'x']
> Now edit config.py adding a new variable:
>     a = [1,3]
>     x = 4
>     t = 0
> Run the above script again, the new variable is not imported: the buffer 
> isn't anyway updated.
> Any idea?
> 

It sounds like you need to to the reload() that Cam mentioned.
Python will not import a module if it is already in its dictionary.

-- 
Stephen Swaney			
sswaney at centurytel.net



More information about the Bf-python mailing list