(fp)
return __import__(from_package, fromlist=[import_name])
Load a module from given file path
    The module's import path is guaranteed to be in the sys.path
    and therefore serializable by spark
Load a module from given file path
    The module's import path is guaranteed to be in the sys.path
    and therefore serializable by spark
Load a module from given file path The module s import path is guaranteed to be in the sys . path and therefore serializable by spark
def get_module_from_fp(fp):
    """Load a module from given file path
    The module's import path is guaranteed to be in the sys.path
    and therefore serializable by spark"""
    _parts = fp.split('/')
    paths = ('/'.join(_parts[:i]) for i in range(len(_parts) - 1, 0, -1))
    path = '.'  # basecase
    for path in paths:
        if path in sys.path:
            break
    from_package, import_name = (
        fp
        .replace(path + '/', '')
        .replace('/', '.')
        .rsplit('.', 1)
    )
    return __import__(from_package, fromlist=[import_name])
def get_module_from_fp ( fp ) : _parts = fp . split ( '/' ) paths = ( '/' . join ( _parts [ : i ] ) for i in range ( len ( _parts ) - 1 , 0 , - 1 ) ) path = '.' # basecase for path in paths : if path in sys . path : break from_package , import_name = ( fp . replace ( path + '/' , '' ) . replace ( '/' , '.' ) . rsplit ( '.' , 1 ) ) return __import__ ( from_package , fromlist = [ import_name ] )