code: def import_related_module(package, pkg_path, related_name,
                            ignore_exceptions=False):
      
      try:
          imp.find_module(related_name, pkg_path)
      except ImportError:
          return
  
      try:
          return getattr(
              __import__('%s' % (package), globals(), locals(), [related_name]),
              related_name
          )
      except Exception as e:
          if ignore_exceptions:
              current_app.logger.exception(
                  'Can not import "{}" package'.format(package)
              )
          else:
              raise e
docs: Import module from given path.