Alias being created?

I am having an issue where obj_location appears to be changing to origin

this is part of a larger bit of code, and this is the part of it that isn’t working as I thought it should:

obj_name = bpy.context.scene.objects[0].name
obj_loc = bpy.data.objects[obj_name].location # set objects location
origin = (0,0,0) # define origin location
bpy.data.objects[obj_name].location = origin # move object to origin

# export to GTLF parameters removed

bpy.data.objects[obj_name].location = obj_loc # set object back to it's original location

When I try a simple Python test this isn’t the case- is there something I am missing here when it comes to Blender Python? Example of testing code below, which when run, Location switches to appropriate values as I expected.

Location = (5,5,5)
LOC = Location

Origin = (0,0,0)

Location = Origin
print('Location = ' + str(Location))

Location = LOC

print('Location = ' + str(Location))

Use bpy.data.objects[obj_name].location.copy() if you want to store the original location properly.

1 Like

Thanks @kkar! I hate it when it is something so simple- but glad at the same time!

Sure, I used to use Python’s copy module until I figured out that appending a copy() function was a thing in the API.