title: Scope of object in custom python package
body: <p>I'm trying to make a 2d graphics package. I've made many attempts of finding the best structure for this, but I can't get it to work nicely. This is the current not working-setup:</p>
  <p>I have the files
  <code>init.py</code>, <code>scene.py</code> and <code>polygon.py</code></p>
  <p><code>scene.py</code> should init one single object, this object has an array where polygons are suppose to be stored in. A simple verison of this file looks like this:</p>
  <pre><code>class make_scene:
      def __init__(self,width,height,**kwargs):
          self.width = width
          self.height = height
          self.color = kwargs.get('color', '#ffffff')
          self.draw_elements = []
  
  #init scene:
  the_scene = make_scene(500, 250) 
  </code></pre>
  <p><code>polygon.py</code> defines some objects to be drawn (circles, cubes etc):</p>
  <pre><code>class cube:
      def __init__(self,x,y,**kwargs):
          self.x = x
          self.y = y
          self.color = kwargs.get('color', '#000000') 
          the_scene.append(self)
  </code></pre>
  <p><code>init.py</code> just imports the modules and some helper packages:</p>
  <pre><code>from .scene import *
  from .polygon import *
  </code></pre>
  <p>However if I try to use this package the scene_file isn't scoped correctly:</p>
  <pre><code>cube(0,0,10,10)
  &gt;&gt;&gt; NameError: name 'the_scene' is not defined
  </code></pre>
  <p>I've been stuck, with multiple different architectures. I can get this to work If i keep it in one file which doesn't seem ideal.</p>
  <p>Ideas to fix this or try a different architecture? I would LOVE your input.</p>