Save Project after Datasmith import?

Hi!
I use a python script to import Datasmith assets like:

UE4Editor-Cmd.exe “D:/my.uproject” -ExecutePythonScript=“D:\DataSmithImport.py”

the Problem is that the Editor closes immediately after import without saving. Is there any command in python to “save all”?

Thanks

Hi @anonymous_user_06c07c15 ,

I can confirm the editor closes immediately (which I find a bit odd as well).

To save your work, you could try adding to your script:

import unreal
unreal.EditorAssetLibrary.save_directory(assetPath)
unreal.EditorLevelLibrary.save_current_level() #in case you have changed things in the current level

assetPath is the path you want to save starting with ‘/Game/’ which is the root folder (Content) of your project
If you only want to save a specific path, just add it, e.g. ‘/Game/anotherFolder’’

Hope that thelps.

-T

1 Like