title: ModuleNotFoundError: No module named 'users'
body: <p>I am trying to import a table from my "users" app but it keeps failing. Prior to this moment I have imported tables from the app into different files in another app without errors.</p>
  
  <p>Here's the stacktrace when I try to run a script from within the app:</p>
  
  <pre><code>Traceback (most recent call last):
    File "trending_tweets.py", line 9, in &lt;module&gt;
      from users.models import Country
  ModuleNotFoundError: No module named 'users'
  </code></pre>
  
  <p>Here's the <code>trending_tweets.py</code> file:</p>
  
  <pre><code>import yweather
  import tweepy
  from decouple import config
  
  # from django.apps import apps
  
  from users.models import Country
  # countries = apps.get_model('users', 'Country')
  
  
  class TrendingTweets:
  
      """
      Class to generate trending tweets within bloverse
      countries
      """
  
      def __init__(self):
          """ 
  
          configuration settings to connect twitter API
          at the point of initialization.
  
          """
          self.api_key = config('TWITTER_API_KEY')
          self.twitter_secret_key = config('TWITTER_SECRET_KEY')
          self.access_token = config('ACCESS_TOKEN')
          self.access_token_secret = config('ACCESS_TOKEN_SECRET')
  
  
      def twitter_api(self):
          """
  
          authentication method to configure twitter settings.
  
          """
          auth = tweepy.OAuthHandler(self.api_key, self.twitter_secret_key)
          auth.set_access_token(self.access_token, self.access_token_secret)
          api = tweepy.API(auth)
  
          return api # auth request object
  
  
      def generate_woeid(self):
          """
          method to generate WOEID of each country
          on our platform
          """
          client = yweather.Client()
  
          woeid_box = []
  
          countries = Country.objects.all()
          for country in countries:
              woeid = client.fetch_woeid(country.name)
              woeid_box.append(woeid)
  
          return woeid_box
  
  
  
  if __name__ == '__main__':
      x = TrendingTweets()
      r = x.generate_woeid()
      print(r)
  </code></pre>
  
  <p>Read about circular imports but still can't find a way to solve this. What am I doing wrong?</p>
  
  <p>Here's my folder structure:</p>
  
  <p><a href="https://i.stack.imgur.com/MbTyV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MbTyV.png" alt="current folder structure"></a></p>
  
  <p>Also, using:</p>
  
  <pre><code>from django.apps import apps
  countries = apps.get_model('users', 'Country')
  </code></pre>
  
  <p>returns this error:</p>
  
  <pre><code>    Traceback (most recent call last):
    File "trending_tweets.py", line 11, in &lt;module&gt;
      countries = apps.get_model('users', 'Country')
    File "/home/myPC/Documents/CODE/venv/lib/python3.6/site-packages/django/apps/registry.py", line 190, in get_model
      self.check_models_ready()
    File "/myPC/myPc/Documents/CODE/venv/lib/python3.6/site-packages/django/apps/registry.py", line 132, in check_models_ready
      raise AppRegistryNotReady("Models aren't loaded yet.")
  django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.
  </code></pre>
  
  <p>My settings.py <code>INSTALLED_APPS</code> list:</p>
  
  <pre><code>INSTALLED_APPS = [
      'django.contrib.admin',
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.messages',
      'django.contrib.staticfiles',
  
      # local apps
      'users',
      'api',
      'posts',
      'generator',
  
      # third-party
      'rest_framework',
      'rest_framework.authtoken',
      'rest_framework_swagger',
      'corsheaders',
  ]
  </code></pre>