def import_dynamic(modname):
    """
    Import and return a module of the given name.  Care is taken to
    avoid issues due to Python's internal directory caching.
    """
    import importlib
    importlib.invalidate_caches()
    __import__(modname)
    return sys.modules[modname]

    Import and return a module of the given name.  Care is taken to
    avoid issues due to Python's internal directory caching.
    
numba/tests/support.py