Python code to reimport asset

I already have a alembic loaded in unreal.
Can anyone help me with a python code to reimport alembic file in unreal.

import unreal

def main():
  task = unreal.AssetImportTask()

  task.filename = "C:\\Path\\To\\"
  task.destination_path = "/Game/Path/To"
  task.destination_name = "SM_Foo"
  task.replace_existing = True
  task.automated = True

  task.options = unreal.AbcImportSettings()
  task.options.import_type = unreal.AlembicImportType.STATIC_MESH

  asset_tools = unreal.AssetToolsHelpers.get_asset_tools()

if __name__ == '__main__':

Worked importing a cube, and overwriting it with a cone.

Far from doing all the things FReimportManager does which gets called from the menu you’re showing, but couldn’t find that for python. The FReimportManager accessed through the menu does extra stuff like broadcasting that a reimport was done and other validation steps.

Guess one could potentially get that FUIAction, set context browser selection and execute that command - or maybe there is a way to do all the same stuff as FReimportManager in python through AssetImportTask.

You can see the code for the menu in AssetFileContextMenu.cpp

Thanks a lot Andreas.
That worked perfect.

The alembic that i imported is the actor in the level. But i was not able to update this actor in the level.
So I was trying to set the ‘geometry cache’ property in the actor details.
But i have 2 problems
1. set_geometry_cache takes NewGeomCache as an arg.How do i do that?
2. In the following method I had to hardcode the name of the actor. Is there any other way, than hardcoding it?

this is my script:

all_actors = unreal.EditorLevelLibrary().get_all_level_actors()
for actor in all_actors:
if actor.get_name() == “RequiredActorName”:
actComp = actor.get_editor_property(“geometry_cache_component”)


Assuming your Alembic is the Geometry Cache, you load that asset and pass it to your unreal.GeometryCacheComponent.set_geometry_cache

To not hardcode you’d make it into a function

def print_name(name):

Got it working…thanks a lot

Hey, Ive been trying o import python libraries in ue4 python but i it always shows the same error “ModuleNotFoundError”. can you help me with this??

Did you solve this issue?
Did you enable the python plugin in unreal