Create New LevelSequence with Python?

How do you create a new level sequence with Python? I can’t find this anywhere. I am developing an engine workflow for a previs company and I’m trying to automate the process of exporting animation from maya and importing it into a new level/levelSequence. I found the necessary code for creating the level and importing animation assets and loading animation to a level sequence, but i can’t find the commands needed to create a level sequence or duplicate an existing template sequence.

I finally found the answer. I’ll include it here if anyone else is looking for the same thing.
I don’t understand why the python scripting is so convoluted. Why can’t there be simple wrappers for all this stuff, like unreal.createThisAssetType(path, name)?

def createNewLevelSequence(dest, name):

asset_tools.create_asset( asset_name = name, package_path = dest, asset_class = unreal.LevelSequence, factory=unreal.LevelSequenceFactoryNew)

Hey There,

Any chance you could share the base code of just creating a timeline and adding an actor? I’ve been trying to accomplish the same with for my current team but as someone with very little programming background its proving a bit more difficult.


hello ,
I also have this question now,
could you solve your question ?
I had tried your the way of your answer ,
but it is not right ,
hope that you can tell more detailed for me ,
thanks a lot!

def create_new_level_sequence(asset_name="LevelSequenceName", destination="/Game/"):
    asset_tools = unreal.AssetToolsHelpers.get_asset_tools()
    asset_tools.create_asset(asset_name, destination, unreal.LevelSequence, unreal.LevelSequenceFactoryNew())

# Python Scripting in Sequencer in Unreal Engine | Unreal Engine 5.0 Documentation
# Create a new level sequence and set its framerate in Python | Unreal engine Code Snippet