Starting to write python scripts as pipeline for repetitive work

Hello,

I am new to unreal engine. I would like to open a mesh-file (.obj), to execute some commands on it (metahuman creator) and then to save the project. All via the CLI with a locally (outside unreal engine workspace) saved python-script.
Is there any literature where I can start with opening a file and then just saving it (for getting an overview how scripting works in UE) ? And then serially executing further commands?
With blender it worked fine for preprocessing the meshes, but with unreal engine I am lost at the moment.

Regards,
Gunther

You run them in console, (need switching to python there). Just install python plugin.
Then put your python code in: \Content\Python

Then there is that mess with python caching compiled scripts, and running old version.

for it i made call python commands like:

import importlib, move
importlib.reload(move)

move.move_assets_with_prefix(
    "/Game/_anims_uefn",
    "/Game/_mh_anims/UEFN_animset",
    "_mh_"
)

Then copy past those to run my scripts

and then scripts i usually code like this one:

import unreal
import os

def move_assets_with_prefix(source_root: str, dest_root: str, prefix: str = "_mh_"):
    """
    Moves all assets starting with `prefix` from source_root to dest_root,
    preserving the subfolder structure.
    """
    asset_registry = unreal.AssetRegistryHelpers.get_asset_registry()
    asset_tools = unreal.AssetToolsHelpers.get_asset_tools()
    asset_lib = unreal.EditorAssetLibrary

    all_assets = asset_registry.get_assets_by_path(source_root, recursive=True, include_only_on_disk_assets=True)

    moved_count = 0

    for asset_data in all_assets:
        asset_name = str(asset_data.asset_name)      # "_mh_Walk"
        asset_package = str(asset_data.package_name) # "/Game/_anims/Subfolder/_mh_Walk"

        if not asset_name.startswith(prefix):
            continue

        # Figure out relative path inside source_root
        rel_path = asset_package.replace(source_root, "", 1).lstrip("/")  
        # rel_path = "Subfolder/_mh_Walk"

        # Separate subfolder and asset name
        rel_dir = os.path.dirname(rel_path)          # "Subfolder"
        dest_folder = dest_root
        if rel_dir:
            dest_folder = f"{dest_root}/{rel_dir}"

        # Ensure destination folder exists
        if not asset_lib.does_directory_exist(dest_folder):
            asset_lib.make_directory(dest_folder)

        # Build final destination asset path
        new_path = f"{dest_folder}/{asset_name}"

        success = asset_lib.rename_asset(asset_package, new_path)
        if success:
            moved_count += 1
            unreal.log(f"Moved {asset_package} -> {new_path}")
        else:
            unreal.log_warning(f"Failed to move {asset_package}")

    # Clean up redirectors in destination tree
    asset_tools.fixup_redirectors(dest_root)

    unreal.log(f"Move complete. {moved_count} assets moved with prefix '{prefix}'.")

not sure if run command is from exactly this script.

Also scripts that process many assets, tend to run out of memory, and freeze editor. So make them process stuff in batches, like 100 or so max.

And i doubt you find any literature how tos or docs, as Epic is constantly changing python api.