One can also use Collections instead of groups:
trail = bpy.data.collections['trail']
This assumes that there is a collection called trail.