the only other module i have is "letter.py" which has a class in it that uses parts from our main file root. in both of these, i have them importing one another (in root, i have the import letter line, and in letter i import root). They are in the same directory. the errors i keep getting involving variables within the two files.
For instance, this is the class in letter:
[source lang="python"]class Letter(pygame.sprite.Sprite):
def __init__(self, name, x, y):
pygame.sprite.Sprite.__init__(self)
self.name = name
self.x = x
self.y = y
self.image = font1.render(self.name, True, WHITE)
self.rect = self.image.get_rect()
self.rect.topleft = [x,y]
def update(self):
self.rect.x += self.change_y
self.rect.y += self.change_x
def draw(self, display):
self.display = display
display.blit(self.image, (self.x, self.y))[/source]
and with it i create these:
[source lang="python"]a = Letter('A', letters_x, letters_y)
b = Letter('B', letters_x, letters_y)
c = Letter('C', letters_x, letters_y)[/source]
When i try to use "a" in root, it says it is not defined. Plus, "letters_x" and "letters_y" are found in root, and they also don't work. This is very frustrating because i thought i knew how to import modules properly. Please help.