Python FBX Export Collection and set FBX file name as Collection name Let me start by saying am no developer, I really suck at python. But save me a few 100 clicks. Can someone save my fingers and tell me what a script will look like if I wanted it to just export the selected collection as FBX and set the name to that collection name?
I hope can save me ;)
Thank you very much
Just to mentioned I was trying to use a script from Python - Exporting Each Selected as FBX
but I can not get it to work
def execute(self, context):
    for obj in bpy.context.selected_objects:
        bpy.ops.object.select_all(action='DESELECT')
        obj.select_set(True)
        org_loc = obj.location.copy()

        # Sends object to zero vectors.
        obj.location = (0,0,0)

        # Creates the path for the exported fbx.
        obj_path = os.path.join(context.scene.worth_group_tools.dir_path,
                                obj.name + &quot;.&quot; + &quot;fbx&quot;)
        # Export object as fbx. Works, except all selected objects are
        # exported into single fbx instead of one at a time from the list.
        bpy.ops.export_scene.fbx(filepath=obj_path, use_selection=True)

        # Prints each object in list.  Works.
        print(obj.name)

        # Returns the object to its original position.
        obj.location = org_loc

return {'FINISHED'}  

I would also love to set the path too, as I can not get it to work too
Some help
Script to export all objects in the context collection into a file named after the collection, into the folder of the blend file.
import bpy
from pathlib import Path

context = bpy.context
scene =  context.scene

#for coll in scene.collection.children: # all 
for coll in [context.collection]:
    bpy.ops.export_scene.fbx(
            {
                &quot;object&quot; : None,
                &quot;active_object&quot; : None,
                &quot;selected_objects&quot; : coll.all_objects,
             },
             filepath=str(
                    Path(bpy.data.filepath).parent
                    / f&quot;{coll.name}.fbx&quot;
                    ),
             use_selection=True,
             )