At first, I load a random object (located in a second window with all other objects). It comes in the first window at the position 0,0,0 (at the center!).
I know its position but not its name. Is there a python script to find its name?
Then I’d like to move this object, but without the name it seems difficult to me.
I hope I was enough clear.
There are a couple of ways to detect the new object. The newly added object should be the active object. You should be able to
add the object
get the active object
That has the name as a property.
Another way is to add the object directly in Python without using the operator. If you do this then when you add, you get a reference to the new object and then you know the name that Blender gave it.
Another trick is to make a list of all the object names, add the object and then see which name was not in the list before.
Those are in addition to trying to find the object at (0,0,0).
I recommend using the active object or adding the object directly.
That is a lot of code. It would take hours to understand what it means that this script “downloads” an object, but you should consider that line 73 is the only line that calls “scene.addObject”. That is the line that creates a new object and you get to access it immediately to get access to the object reference. In the BGE having a reference is much more important than having the object name since there can be multiple objects with the same name but each reference has to be unique.