You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yeah, this is a general problem with import cycles. In this example, if you run mypy -v bar.py you should see that it processes foo.py entirely before processing bar.py.
The recommended work-around is to break the cycle by putting some imports inside functions. In your example, bar's import of foo seems less fundamental than foo's import of bar, so if you change bar to
On certain situations with circular imports, some of the types defined on the circular import are not available, even as a comment/forward reference:
If I have these two files, then I get:
(Note that this isn't a "MyType is an undefined name error, it's an "Invalid type"). I was expecting the bar.MyType reference to be possible.
This structure is quite similar to the one in #1972 (and came from the same piece of code), these issues might be related
The text was updated successfully, but these errors were encountered: