I'm usually used to Laravel PHP where I am able to do things such as Auth::User()->name however I need to make a game in Python for my class.
I would like to be able to do Colours.black or something similar however I am struggling.
I have a Python file called Colours.py and it looks something like this:
import json
class Colours(object):
    def __init__(self):
        with open('app/colours.json') as data:
                self.__dict__ = json.loads(data)
My JSON file looks like this:
[
  {
    "black": "(0, 0, 0)",
    "white": "(255, 255, 255)",
    "green": "(0, 255, 0)"
  }
]
And then in another Python file called Main.py I have the following:
from app.models import Colours
print(dir(Colours))
This code does not work.
Edit: Sorry forgot to give the output:
['Colours', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'json']
Edit 2: I am able to do:
print(Colours.Colours().black)
## Output: (0, 0, 0)
However I was wondering whethere this is a way to do Just Colours.black?
 
     
    