Reputation: 143
I am currently making a game which uses multiple modules to run. However when I try to run the program the modules do not seem to work. And example of this is when the program doesn't recognise functions from modules in main.
https://gyazo.com/9d303b12707f5829e084125b76d8cdf9
I expected to not recieve to not recieve the error message from above. As well as this I wanted to recognise what jedi is.
Here is my code:
Main(Module):
import jedi
def mains():
jedi = Jedi()
if __name__ == '__main__':
mains()
Jedi(module):
import pygame
class Jedi(pygame.sprite.Sprite):
def __init__(self):
super().__init__()
self.move_rights = []
self.move_lefts = []
self.image = pygame.image.load("obileft.png")
self.move_lefts.append(self.image)
self.image = pygame.transform.flip(self.image, True, False)
self.move_rights.append(self.image)
self.sprite_x_change = 0
self.sprite_y_change = 0
self.rect = self.image.get_rect()
self.rect.y = 400
self.rect.x = 120
self.nextLevel = False
self.right = False
self.left = False
self.jump = False
self.lightsaberRight = False
self.lightsaberLeft = False
# Mobility: Left, right, up and stop
Upvotes: 2
Views: 5851
Reputation: 331
You need to import the class in a correct way. For example:
from package.module import class
in your case from jedi import Jedi
Upvotes: 1