If A is my application, B is buggy, and C is some other library, consider:
# A.py monkeypatch_B() import C # C.py B = __import__('B') # B.py bugs()