I have a module named directory and another module named species. There will always only be one directory no matter how many species i have.
In the directory module i have 1 directory class. Inside the Species module i have many different species classes.
#module named directory
class directory:
def __init__(self):
...
def add_to_world(self, obj, name, zone = 'forrest', space = [0, 0]):
...
#module named species
class Species (object):
def __init__(self, atlas):
self.atlas = atlas
def new(self, object_species, name, zone = 'holding'):
self.object_species = object_species
self.name = name
self.zone = zone
self.atlas.add_to_world(object_species, name)
class Lama(Species):
def __init__(self, name, atlas, zone = 'forrest'):
self.new('Lama', name)
self.at = getattr(Entity, )
self.atlas = atlas
The problem is that in each of my classes i have to pass the atlas object to that species. How can i just tell the species to get an instance from a different module.
Example if i have an instance of 'atlas' in module named Entity with a class Entity, how can i tell all species with a few lines of code to grab that instance from Entity?