(fullname)
return sys.modules[fullname]
Load thrift_file by fullname, fullname should have '_thrift' as
    suffix.
    The loader will replace the '_thrift' with '.thrift' and use it as
    filename to locate the real thrift file.
Load thrift_file by fullname, fullname should have '_thrift' as
    suffix.
    The loader will replace the '_thrift' with '.thrift' and use it as
    filename to locate the real thrift file.
Load thrift_file by fullname fullname should have _thrift as suffix . The loader will replace the _thrift with . thrift and use it as filename to locate the real thrift file .
def load_module(fullname):
    """Load thrift_file by fullname, fullname should have '_thrift' as
    suffix.
    The loader will replace the '_thrift' with '.thrift' and use it as
    filename to locate the real thrift file.
    """
    if not fullname.endswith("_thrift"):
        raise ImportError(
            "ThriftPy can only load module with '_thrift' suffix")

    if fullname in sys.modules:
        return sys.modules[fullname]

    if '.' in fullname:
        module_name, thrift_module_name = fullname.rsplit('.', 1)
        module = _import_module(module_name)
        path_prefix = os.path.dirname(os.path.abspath(module.__file__))
        path = os.path.join(path_prefix, thrift_module_name)
    else:
        path = fullname
    thrift_file = "{}.thrift".format(path[:-7])

    module = load(thrift_file, module_name=fullname)
    sys.modules[fullname] = module
    return sys.modules[fullname]
def load_module ( fullname ) : if not fullname . endswith ( "_thrift" ) : raise ImportError ( "ThriftPy can only load module with '_thrift' suffix" ) if fullname in sys . modules : return sys . modules [ fullname ] if '.' in fullname : module_name , thrift_module_name = fullname . rsplit ( '.' , 1 ) module = _import_module ( module_name ) path_prefix = os . path . dirname ( os . path . abspath ( module . __file__ ) ) path = os . path . join ( path_prefix , thrift_module_name ) else : path = fullname thrift_file = "{}.thrift" . format ( path [ : - 7 ] ) module = load ( thrift_file , module_name = fullname ) sys . modules [ fullname ] = module return sys . modules [ fullname ]