Referencing object spawned

Hey, a long time Blender user here but only a couple of months of experience with programming in Python in Blender, and even then it’s not been very intensive.
I’ve been scouring the internet for answers, but cannot find any. When I spawn objects, for the life of me I can’t figure out how to reference them. I currently use “.objectLastCreated” but it’s rather limited in that I can’t reference other objects. I know I’m not meant to reference them by name because they all have the same one but I don’t know how to do this. Any ideas?

Thank you profusely to anyone who helps :slight_smile: