How can classes work in the same file but if they are seperated then imported properly there are errors?
<p>I am new to programming, I have made a little program just to learn how to use python and I made this. </p>

<p>It works just fine if I have it in one file, but when I seperate it into three files calles Atlas.py , Robot.py and Test.py.</p>

<p>I get an error: "Undefined Variable: Atlas" in the robot class on the <strong>init</strong> line.</p>

<p>I have commented which file it is inside in a comment right above.</p>

<pre><code>#Atlas.py
class Atlas:

def __init__(self):
    self.robots = []
    self.currently_occupied = {}

def add_robot(self, robot):
    self.robots.append(robot)
    self.currently_occupied = {robot:[]}


#Robot.py
class Robot():

def __init__(self, rbt, atlas = Atlas): #This is the main error:"Undefined Variable: Atlas" This happens after i seperate the file
    self.xpos = 0
    self.ypos = 0
    self.atlas = atlas()
    self.atlas.add_robot(rbt)
    self.name = rbt

def walk(self, axis, steps=2):
    ....

#Test.py
robot1 = Robot("robot1")
</code></pre>

<p>I put these classes into the corresponding files and Test.py looks like this now:</p>

<pre><code>#Test.py
import Robot
robot1 = Robot("robot1")
</code></pre>
