import bpy import sys argv = sys.argv argv = argv[argv.index("--") + 1:] assert len(argv) >= 1 output_path = argv[0] assert output_path.endswith(".gltf") or output_path.endswith(".glb") bpy.ops.export_scene.gltf( filepath=output_path, use_visible=True, )