Massive red flag here. At the very least, this should log a warning.

Also, instead of the double-break, I'd suggest writing a generator and looping over it, something like this:
```python
def parent_and_child(modules):
    """Generate parent/child pairs"""
    for parent in modules:
        for child in parent.get_children():
            yield parent, child

def get_parent(child, modules):
    for candidate_parent, candidate_child in parent_and_child(modules):
        if child.location == candidate_child.location:
            return candidate_parent

parent = get_parent(self, all_modules)
```

But you should also check if there is a more efficient way of doing this.