calling a new class instance from a dictionary [solved]

Hi, I’m working on taking a dictionary that will return a new instance of an object.

myDict={"item1":Class1(),"item2":Class2()}

This does not work, it only returns a reference of the object created when myDict is created.

Is it possible to do what I’m looking to do?

You’ll want to do something like this:

myDict={"item1":Class1,"item2":Class2}

then

item1_instance = myDict["item1"]()

or

item2 = myDict["item2"]
item2_instance = item2()

Thanks, works perfectly