Some questions to emptys and collections

Hi all,

i recieve via UDP socket a dictionary stream.
Each dictionary[key] = value is a number(key) and a x,y tuble for a location.
can someone give me some tips to do the following.

.create a empty for each key with key as name
.put this empty in a specific collection by collection name
.delete this empty by key name.

for name, loc in dictionary.items():
    empty =, None)
    empty.location = loc["Collection Name"], do_unlink=True)

1 Like

many Thanks,

do you know why the key 1 seams not to work.
It creates all time 1.001 but 1 isn already created.

import bpy
from collections import OrderedDict 

D = OrderedDict([(1, [1, 8]),(2,[2,10])])
for name,loc in D.items():
    empty =,None)
    empty.location = loc['Collection 1']


Probably you tried to link an empty to nonexistent collection, so it was created, but not added to the scene. To clean it open orphan data in outliner and press purge
or run

for ob in
    if not ob.users:, do_unlink=False)

And I made a mistake. To remove an empty by a key name use

name = "1"
ob =
if ob is not None:, do_unlink=True)
1 Like