def import_file_to_module(module_name, fpath):
 try:
  _ast = import_file_to_ast(fpath, module_name)
  mod = imp.new_module(module_name)
  mod.__file__ = fpath
  eval(ast_compile(_ast, fpath, 'exec'), mod.__dict__)
 except (HyTypeError, LexException) as e:
  if (e.source is None):
   with open(fpath, 'rt') as fp:
    e.source = fp.read()
   e.filename = fpath
  raise
 except Exception:
  sys.modules.pop(module_name, None)
  raise
 return mod

def import_file_to_module ( module_name , fpath ) : try : _ast = import_file_to_ast ( fpath , module_name ) mod = imp . new_module ( module_name ) mod . __file__ = fpath eval ( ast_compile ( _ast , fpath , 'exec' ) , mod . __dict__ ) except ( HyTypeError , LexException ) as e : if ( e . source is None ) : with open ( fpath , 'rt' ) as fp : e . source = fp . read ( ) e . filename = fpath raise except Exception : sys . modules . pop ( module_name , None ) raise return mod
import content from fpath and puts it into a python module .