I ran into this recently and it was due to circular imports - I had a types file that imported from a model file, but that model file also imported from the types file. The solution was to remove the circular dependency.
types
model