title: Python class defined in the same file as another class - how do you get access to the one defined later in the file?
body: <p>I'm very new to Python, I figure this question should be easy to answer.</p>
  
  <p>My problem simplified is this...</p>
  
  <p>I have 2 classes in a File class A and class B. Class A is defined first in the file and class B is defined second.</p>
  
  <pre><code>class A
      ...
  
  class B
      ...
  </code></pre>
  
  <p>How do I get access to class B with class A?</p>
  
  <pre><code>class A
      something = B
  
  class B
      somethingElse = A
  </code></pre>
  
  <p>Here is the actual code I'm trying to fix</p>
  
  <pre><code>class FirstResource(_ModelResource):
      class Meta(_Meta):
          queryset = First.objects.all()
          resource_name = 'first'
          allowed_methods = ['get','put']
  
          filtering = {
              'a': ALL_WITH_RELATIONS,
              'b': ALL_WITH_RELATIONS,
              'c': ALL_WITH_RELATIONS,
          }
  
          ordering = ['apt']
  
      # this is the line that would fix everything
      second = fields.ForeignKey(SecondResource, 'second', null=True, blank=True, default=None, full=True) 
  
      ...
  
   class SecondResource(_ModelResource):
      class Meta(_Meta):
          queryset = Second.objects.all()
          resource_name = 'second'
          execute_methods = ['get', 'post']
          filtering = {
              'name': ['exact'],
              'leader': ['exact'],
          }   
  
      super = fields.ForeignKey(FirstResource, 'super', null=True, blank=True, default=None, full=True)
      leader = fields.ForeignKey(FirstResource, 'leader', null=True, blank=True, default=None, full=True)
  
      ...
  </code></pre>
  
  <p>With no pre-declaring in Python I'm really not sure how to solve this problem. The First in models.py has a ForeignKey of Second, and Second has 2 Foreign keys of First.</p>
  
  <p>Moving A below B does not solve the problem since B also needs A. I didn't write the code I'm simply trying to fix it - I need the 'second' foreign key back when I do a 'get' for the resource in both classes.</p>