def loadScript(script_name):

    # call other script
    prefix, suffix = os.path.splitext(script_name)

    dirname = os.path.relpath(os.path.dirname(script_name))
    basename = os.path.basename(script_name)[:-3]

    if os.path.exists(prefix + ".pyc"):
        try:
            os.remove(prefix + ".pyc")
        except OSError:
            pass

    modulename = ".".join((re.sub("/", ".", dirname), basename))
    try:
        module = importlib.import_module(modulename)
    except __HOLE__, msg:
        sys.stderr.write('could not import %s - skipped: %s\n' %
                         (modulename, msg))
        module = None

    return module, modulename
dataset/ETHPy150Open CGATOxford/cgat/tests/test_commandline.py/loadScript