Skip to content
← Back to Community
A python question
Profile icon
ia13ru

I have a question which is in this post. I am reposting this as it has been ignored.
The post
Thank you in advance. :-)

Answered by ANDREWVOSS [earned 5 cycles]
View Answer
Voters
Profile icon
FortniteBot20
Profile icon
LoganLoftus
Profile icon
Pradeepsahoo1
Profile icon
LiaWaterfield
Profile icon
ia13ru
Comments
hotnewtop
Profile icon
ANDREWVOSS

The best solution would be to create a list:

objects = [object1,object2,object3] for object in objects: object.function()
Profile icon
MadMath123

You can't reference a variable name in Python. The best solution would to make an array of objects, like @ANDREWVOSS wrote. The vars() function is used to get all class vars of an object into one dict (useful for debugging or referencing). If you want to make another object the same way as another, the vars() function might be useful.

Profile icon
ANDREWVOSS

@MadMath123 I didn't even think of that, that's really clever.