I have a dictionary called complete_colour_hex and I want to cut it down to a few entries that are in a list called used.
When I run the following I get 'complete_colour_hex' is not defined.
class Colours:
    complete_colour_hex = {
        1:['FFFFFF',15],    2:['9C9C9C',7],     3:['FFE383',18],    4:['F45C40',12],    5:['DEC69C',19],
    }
    used = [1, 2, 3]
    # colour_hex = {}
    # for e in used:
    #     colour_hex[e] = complete_colour_hex[e]
    colour_hex = {e: complete_colour_hex[e] for e in used}
    print(colour_hex)
But if I uncomment the three lines and comment the colour_hex = {e:... then it works.
Also, either way outside of a class works fine. Why is that in a class, doing it in one line doesn't work?
 
    