def getModuleWithDirectoryPath(directoryPath, fileName):
 if (fileName == ''):
  print 'The file name in getModule in archive was empty.'
  return None
 originalSystemPath = sys.path[:]
 try:
  sys.path.insert(0, directoryPath)
  folderPluginsModule = __import__(fileName)
  sys.path = originalSystemPath
  return folderPluginsModule
 except:
  sys.path = originalSystemPath
  print ''
  print 'Exception traceback in getModuleWithDirectoryPath in archive:'
  traceback.print_exc(file=sys.stdout)
  print ''
  print ('That error means; could not import a module with the fileName ' + fileName)
  print ('and an absolute directory name of ' + directoryPath)
  print ''
 return None

def getModuleWithDirectoryPath ( directoryPath , fileName ) : if ( fileName == '' ) : print 'The file name in getModule in archive was empty.' return None originalSystemPath = sys . path [ : ] try : sys . path . insert ( 0 , directoryPath ) folderPluginsModule = __import__ ( fileName ) sys . path = originalSystemPath return folderPluginsModule except : sys . path = originalSystemPath print '' print 'Exception traceback in getModuleWithDirectoryPath in archive:' traceback . print_exc ( file = sys . stdout ) print '' print ( 'That error means; could not import a module with the fileName ' + fileName ) print ( 'and an absolute directory name of ' + directoryPath ) print '' return None
get the module from the filename and folder name .