Properly handle circular imports when building module tracker