# ask-community

Andras Somi

03/30/2023, 10:29 AM
Hi all, I’m creating a Pythonic resource to wrap an API and I want to create a session object to be used for all calls in from the resource methods. I know from Pydantic that I can use
to create private attributes and even have a default factory to populate them, eg:
Copy code
class MyResource(ConfigurableResource):
    api_key: str
    _session: ClientSession = PrivateAttr(default_factory=session_factory)
But what if I need one of the public attributes (eg.
) from the resource object to be used in the
? This pattern won’t work, I’d need some sort of post init hook where I can set up
before the instantiated resource itself is passed to the assets/ops. How should I do this?