This happened to me due to a circular dependency between 2 files importing each other. The fix is to make sure that there's no circular dependency, e.g., by moving shared function to a separate file.