Reloading the already imported module

A

anil.pundoor

hi all,
i have following code


if <condition>
from SIPT.xml_param_mapping import
MESSAGE_PARAMETER_MAPPING
else:
from SIPT.msg_param_mapping import
MESSAGE_PARAMETER_MAPPING


parameter_list = MESSAGE_PARAMETER_MAPPING [
'ABC' ]
for parms in parameter_list:

parameter_list[parms][4] = 'EXPORT'

parameter_list[parms][5] = 'IMPORT'


After this the xml_param_mapping gets altered. this process is
repeated over couple of time. But every time i need to get a fresh
xml_param_mapping. So how to relaod the already imported module??



regards
Anil
 
P

Paul McGuire

hi all,
i have following code


if <condition>
from SIPT.xml_param_mapping import MESSAGE_PARAMETER_MAPPING
else:
from SIPT.msg_param_mapping import MESSAGE_PARAMETER_MAPPING

parameter_list = MESSAGE_PARAMETER_MAPPING ['ABC' ]
for parms in parameter_list:
parameter_list[parms][4] = 'EXPORT'
parameter_list[parms][5] = 'IMPORT'


After this the xml_param_mapping gets altered. this process is
repeated over couple of time. But every time i need to get a fresh
xml_param_mapping. So how to relaod the already imported module??

Why not work with a copy of MESSAGE_PARAMETER_MAPPING['ABC'], and keep the
original intact? Change:

parameter_list = MESSAGE_PARAMETER_MAPPING ['ABC' ]

to

parameter_list = MESSAGE_PARAMETER_MAPPING ['ABC' ][:]

Now no reimport is required.

-- Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top