Create a object with collection instance by link to another blendfile collection by its name

I currently use this to add groups by name as object instance,
can’t get it to work with collections…: plese give me some help…

for valgrp in validgroups:

            with, link=True) as (data_from, data_to):
                data_to.groups = [valgrp]
                # data_to.groups = data_from.groups

            for grp in data_to.groups:
                if grp is not None:
                    instance ='dupli_group', None)
                    instance.dupli_type = 'GROUP'
                    instance.dupli_group = grp

           = objname
                    instance.location = loc
                    instance.scale = sca
                    instance.rotation_euler = rot

Some things were renamed, for this script mainly:

groups -> collections
dupli_type -> instance_type
dupli_group -> instance_collection ->

yeah, thanks, it would have took me ages to find the renames out…
also .instance_type = ‘COLLECTION’ now, works flawless :+1: