'reload' a variable in python
<p>So I have the following situation. I have a configuration class config.py that holds a number of system setting variables like:</p>

<pre><code>class TVBSettings():

    TVB_CONFIG_FILE = os.path.expanduser(os.path.join("~", 'tvb.configuration'))
    TVB_STORAGE = os.path.expanduser(os.path.join("~", "TVB" + os.sep))

    .... etc ...
</code></pre>

<p>Now besides this I have a configuration file that when it exists will overwrite a couple of these variables. In order to display these 'overwritable' configuration variables in the UI I'm using genshi/cherrypy and I have a base dictionary in a SettingsService that speficifies some info like (in setttingsservice.py):</p>

<pre><code>from tvb.config import TVBSettings as cfg

CONFIGURABLE_KEYS = {'TVB_STORAGE':{'label':'Root used for all you projects:', 
                                    'value':cfg.TVB_STORAGE,
                                    'type':'text'},
                    'SERVER_IP':{'label':'Server name:', 
                                 'value':cfg.SERVER_IP, 
                                'type':'text'},
                    'WEB_SERVER_PORT':{'label':'The port used by cherrypy:', 
                                        'value':cfg.WEB_SERVER_PORT, 
                                        'dtype':'primitive',
                                        'type':'text'},  
                    ... other entries ... }
</code></pre>

<p>Now this settingsservice.py also has a method <code>update_configuration()</code> that read from the configuration file and modifies the default parameters frim cfg. This works fine and the changes are seen troughout the rest of the system, however the CONFIGURABLE_KEYS dictionary still holds the old values (i.e. in the example above even if cfg.TVB_STORAGE is modified from the configuration file, in the dictionary the old value is still kept). Now I'm guessing it's for the same reason that the changes are not done if I do:</p>

<pre><code>&gt;&gt;&gt; class A:
...  x = 1
&gt;&gt;&gt; a = {1: A.x}
&gt;&gt;&gt; A.x = 2
&gt;&gt;&gt; a
{1: 1}
</code></pre>

<p>So my question would be is there any way to force python to 'reload' that variable to take into account the new changes.</p>

<p>EDIT (after sblom response):</p>

<p>That is not really an option in my case, <code>cfg</code> would be the <code>A</code> from that example and <code>CONFIGURABLE_KEYS</code> needs different entries for a number of different variabled from <code>cfg</code>.</p>

<p>Regards,
Bogdan</p>
