1

I have this project structure

Bot/
-- bot.py
FlapPyBird/
-- flappy.py
run.py

bot.py:

import pygame
from pygame.locals import *

def run(upperPipes, lowerPipes, playerInfo):
    pass

flappy.py:

from itertools import cycle
import random
import sys

import pygame
from pygame.locals import *

def doStuff(bot)
    some stuff

and run.py:

import FlapPyBird as game
import Bot as bot

def main():
    game.doStuff(bot)

if __name__ == '__main__':
    main()

And I'm getting this error running 'python run.py'

Traceback (most recent call last):
File "C:/Users/Kyle/IdeaProjects/flappy_bird_bot/run.py", line 8, in <module>
main()
File "C:/Users/Kyle/IdeaProjects/flappy_bird_bot/run.py", line 5, in main
game.doStuff(Bot)

AttributeError: module 'FlapPyBird' has no attribute 'doStuff'

What am I not understanding? How can I abstract away my two packages so I can call them from my root directory?

CDspace
  • 2,639
  • 18
  • 30
  • 36

0 Answers0