Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7953655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:12:34+00:00 2026-06-04T03:12:34+00:00

I am new to programming, I have made a little program just to learn

  • 0

I am new to programming, I have made a little program just to learn how to use python and I made this.

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

I get an error: “Undefined Variable: Atlas” in the robot class on the init line.

I have commented which file it is inside in a comment right above.

#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 separate 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")

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

#Test.py
import Robot
robot1 = Robot("robot1")
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T03:12:35+00:00Added an answer on June 4, 2026 at 3:12 am

    In Robot.py your first line should be (assuming the file is called Atlas.py):

    from Atlas import Atlas
    

    meaning “from the Atlas.py file (also known as the Atlas module) import the Atlas class”, so the Atlas variable becomes available in the Robot.py file (also known as the Robot module).

    IOW, if you need the Robot class in another file (and it still lives in the Robot module at Robot.py), you’ll need to add “from Robot import Robot” to that new file.

    I suggest you read as much of the Python Tutorial as you can. Otherwise, your current problems are more directly about modules, so read that section.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am new kernel programming.i have been trying to load this driver program for
I am just new to programming in Unix and have a small issue that
I am new to OpenGL programming.I have made a rotating cube with different images
I'm new to object oriented programming. I have made a class with a static
I'm very much new to programming and have been doing fairly well so far.
I am new to web programming...I have been asked to create a simple Internet
I'm new to PHP programming and have poor knowledge about it, but I want
I'm new to microcontroller programming and I have interfaced my microcontroller board to another
I'm new to programming and stackoverflow and have decided to start by learning objective
I am new to programming. I have been trying to write a function in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.