LevelExporterUSD won't export

Hi, I have a level and inside I have a sub-level. I filter it’s actor and open that sub-level, then I try to export this level using LevelExporterUSD. Can you tell me if my script is wrong or if this is a bug?

This is my script inside VSCode. When I change the USD for FBX it works btw.

When I run with debugging it brings me to level_exporter.py where it throws this error. Inside export_with_cdo_options() the line: context.root_layer_path = options_cdo.current_task.filename
Exception has occurred: AttributeError
‘NoneType’ object has no attribute ‘filename’

Also I am using UE 5.7

The dev confirmed it is a known limitation to this approach.

At the moment, the recommended, and cleaner way, is to call the export directly

from usd_unreal import exporting_utils, level_exporter

context = exporting_utils.UsdExportContext()
context.root_layer_path = lvl_export_path
context.options = usd_options
context.world = world

level_exporter.export(context)

1 Like

Are there API docs for usd_unreal ?

I am not aware of an API doc for those functions,

however the code is there Engine/Plugins/Importers/USDImporter/Content/Python/usd_unreal/

each function has a description in comments.

thank you