Reloading the already imported module

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • anil.pundoor@gmail.com

    #1

    Reloading the already imported module

    hi all,
    i have following code


    if <condition>
    from SIPT.xml_param_ mapping import
    MESSAGE_PARAMET ER_MAPPING
    else:
    from SIPT.msg_param_ mapping import
    MESSAGE_PARAMET ER_MAPPING


    parameter_list = MESSAGE_PARAMET ER_MAPPING [
    'ABC' ]
    for parms in parameter_list:

    parameter_list[parms][4] = 'EXPORT'

    parameter_list[parms][5] = 'IMPORT'


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



    regards
    Anil

  • Paul McGuire

    #2
    Re: Reloading the already imported module

    <anil.pundoor@g mail.comwrote in message
    news:1168519894 .160024.70930@o 58g2000hsb.goog legroups.com...
    hi all,
    i have following code
    >
    >
    if <condition>
    from SIPT.xml_param_ mapping import MESSAGE_PARAMET ER_MAPPING
    else:
    from SIPT.msg_param_ mapping import MESSAGE_PARAMET ER_MAPPING
    >
    parameter_list = MESSAGE_PARAMET ER_MAPPING ['ABC' ]
    for parms in parameter_list:
    parameter_list[parms][4] = 'EXPORT'
    parameter_list[parms][5] = 'IMPORT'
    >
    >
    After this the xml_param_mappi ng gets altered. this process is
    repeated over couple of time. But every time i need to get a fresh
    xml_param_mappi ng. So how to relaod the already imported module??
    >
    Why not work with a copy of MESSAGE_PARAMET ER_MAPPING['ABC'], and keep the
    original intact? Change:

    parameter_list = MESSAGE_PARAMET ER_MAPPING ['ABC' ]

    to

    parameter_list = MESSAGE_PARAMET ER_MAPPING ['ABC' ][:]

    Now no reimport is required.

    -- Paul



    Comment

    Working...