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 7952843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:58:59+00:00 2026-06-04T02:58:59+00:00

#Maps.py class Maps(object): def __init__(self): self.animals = [] self.currently_occupied = {} def add_animal(self, name):

  • 0
#Maps.py
class Maps(object):

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

    def add_animal(self, name):
        self.animals.append(name)
        self.currently_occupied = {robot:[0, 0]}



#animal.py
class Animal(object):

    def __init__(self, name):
        import maps
        maps.add_animal(rbt)
        self.name = name


#Tproject.py
from Animal import Animal
Fred = Animal("Fred")

gives me this an error that looks like this

TypeError: unbound method add_animal() must be called with Maps instance as first argument (got str instance instead)

but i dont know what it means and i cannot figure it out searching through google or yahoo 🙁

  • 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-04T02:59:00+00:00Added an answer on June 4, 2026 at 2:59 am

    You need an instance of Maps, not the Maps class:

     maps.Maps.add_animal("Fred") # gives error
    
     mymap = maps.Map()
    
     mymap.add_animal("Fred") # should work
    

    So you should either have a mymap attribute on the Animal class, per Animal instance or as a global object (whatever works best for your case).

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

Sidebar

Related Questions

import com.google.android.maps.MapActivity; import com.google.android.maps.MapView; import android.os.Bundle; public class Map2Activity extends MapActivity { /** Called
I have a class that maps incoming messages to matching readers based on the
Anyone have a suggestion for a good utility class that maps values from one
I'm trying to create a custom javascript class that inherits from google.maps.Map (V3 API).
I have the following Domain Object: public class DomainClass { public int Id {
Given the following Fluent NHibernate maps: public class FastTrackPackageClassMap : ClassMap<FastTrackPackage> { public FastTrackPackageClassMap()
Is there a Java class that maps (via JNI) to the C sockaddr_in structure?
I have an object that in a simplified form is as follows: public class
As part of an ongoing class project, we were asked to implement Maps for
If I have an object that implements an interface, it maps the interface methods

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.