def cython_import(filename, verbose=False, compile_message=False, use_cache=False, create_local_c_file=True): """ Compile a file containing Cython code, then import and return the module. Raises an ``ImportError`` if anything goes wrong. INPUT: - ``filename`` - a string; name of a file that contains Cython code OUTPUT: - the module that contains the compiled Cython code. """ name, build_dir = cython(filename, verbose=verbose, compile_message=compile_message, use_cache=use_cache, create_local_c_file=create_local_c_file) sys.path.append(build_dir) return __builtin__.__import__(name)