Fix Python – How can I create an object and add attributes to it?

I want to create a dynamic object (inside another object) in Python and then add attributes to it.
I tried:
obj = someobject
obj.a = object()
setattr(obj.a, ‘somefield’, ‘somevalue’)

but this didn’t work.
Any ideas?
I am setting the attributes from a for loop which loops through a list of values, e.g.
params = [‘attr1’, ‘attr2’, ‘attr3’]

[Fixed] Getting attributes of a class

I want to get the attributes of a class, say:
class MyClass():
a = “12”
b = “34”

def myfunc(self):
return self.a

using MyClass.__dict__ gives me a list of attributes and functions, and even functions like __module__ and __doc__. While MyClass().__dict__ gives me an empty dict unless I explicitly set an attribute value of that instance.
I just want the attributes, in the example above those would be: a and b