Why not set a class attribute in the __init__? New objects can check if it exists and use the data, or if it doesn't exist assume it's the first object and create the data.
import random class MyClass(): info = 0 def __init__(self): if self.info == 0: #configure things print(f"Configuring class info on first use.") MyClass.info = random.randint(1000, 100000) print(f"Created new object {id(self)}. Class info is {self.info}") [MyClass(), MyClass(), MyClass()]
Output:Configuring class info on first use.
Created new object 4366991120. Class info is 81133
Created new object 4366990976. Class info is 81133
Created new object 4367286480. Class info is 81133