Trouble with Intelij IDEA importing classes, "cannot find reference" but code still works - Python

Viewed 664

I am having problems with Intelij IDEA (community edition 2019.3.3 with the latest updates). When I ty to import a class from a different .py file that I have made, it is red underlined and says "cannot find reference". The code still works fine but it is really annoying it doesnt give me options when I start typing .lives or .name etc

I have tried invalidate caches / restart but after it finishes indexing the problem is back, how could I sort this?

enter image description here

folder hierarchy screen shot

class Player:
def __init__(self, name):
    self.name = name
    self._lives = 3
    self._level = 1
    self._score = 0

Main

from player import Player

kev = Player("Kevin")
print(kev.name)
1 Answers
Related