def run_module(mod_name, init_globals=None, run_name=None, alter_sys=False):
 (loader, code, fname) = _get_module_details(mod_name)
 if (run_name is None):
  run_name = mod_name
 pkg_name = mod_name.rpartition('.')[0]
 if alter_sys:
  return _run_module_code(code, init_globals, run_name, fname, loader, pkg_name)
 else:
  return _run_code(code, {}, init_globals, run_name, fname, loader, pkg_name)

def run_module ( mod_name , init_globals = None , run_name = None , alter_sys = False ) : ( loader , code , fname ) = _get_module_details ( mod_name ) if ( run_name is None ) : run_name = mod_name pkg_name = mod_name . rpartition ( '.' ) [ 0 ] if alter_sys : return _run_module_code ( code , init_globals , run_name , fname , loader , pkg_name ) else : return _run_code ( code , { } , init_globals , run_name , fname , loader , pkg_name )
execute a modules code without importing it returns the resulting top level namespace dictionary .