def find_modules_importing(dot_path, starting_with):
    """
    Finds all the modules importing a particular attribute of a module pointed to by dot_path that starting_with is dependent on.

    :param dot_path: The dot path to the object of interest
    :type dot_path: str
    :param starting_with: The module from which to start resolving dependencies. The only modules importing dot_path returned will be dependencies of this module.
    :type starting_with: types.ModuleType

    :rtype: list of tuples
    :returns: A list of module, name, object representing modules depending on dot_path where module is a reference to the module, name is the name of the object in that module, and object is the imported object in that module.
    """
    klass = None
    filtered = []

    if '.' not in dot_path:
        module_or_method = __import__(dot_path)
    else:
        getter, attribute = _get_target(dot_path)
        module_or_method = getattr(getter(), attribute)

    if isinstance(module_or_method, types.UnboundMethodType):
        klass = getter()
        module_or_method = klass

    deps = find_dependencies(inspect.getmodule(starting_with))

    for depth, dependencies in deps.items():
        for dependency in dependencies:
            module, name, object = dependency
            if object == module_or_method:
                if klass:
                    filtered.append((module, name, (klass, attribute)))
                else:
                    filtered.append((module, name, object))

    return filtered
def find_modules_importing ( dot_path , starting_with ) : klass = None filtered = [ ] if '.' not in dot_path : module_or_method = __import__ ( dot_path ) else : getter , attribute = _get_target ( dot_path ) module_or_method = getattr ( getter ( ) , attribute ) if isinstance ( module_or_method , types . UnboundMethodType ) : klass = getter ( ) module_or_method = klass deps = find_dependencies ( inspect . getmodule ( starting_with ) ) for depth , dependencies in deps . items ( ) : for dependency in dependencies : module , name , object = dependency if object == module_or_method : if klass : filtered . append ( ( module , name , ( klass , attribute ) ) ) else : filtered . append ( ( module , name , object ) ) return filtered
Finds all the modules importing a particular attribute of a module pointed to by dot_path that starting_with is dependent on.

    :param dot_path: The dot path to the object of interest
    :type dot_path: str
    :param starting_with: The module from which to start resolving dependencies. The only modules importing dot_path returned will be dependencies of this module.
    :type starting_with: types.ModuleType

    :rtype: list of tuples
    :returns: A list of module, name, object representing modules depending on dot_path where module is a reference to the module, name is the name of the object in that module, and object is the imported object in that module.