# How to run script after asset import into level?

**URL:** <https://forums.unrealengine.com/t/how-to-run-script-after-asset-import-into-level/624287>\
**Category:** Pipeline & Plugins\
**Tags:** Blender, FBX-Importing, unreal-engine, UE5-0, question\
**Created:** [August 8, 2022, 11:46pm UTC](https://forums.unrealengine.com/t/how-to-run-script-after-asset-import-into-level/624287 "2022-08-08T23:46:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![oldhighscore](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@oldhighscore](https://forums.unrealengine.com/u/oldhighscore)\
**Post date:** [August 8, 2022, 11:46pm UTC](https://forums.unrealengine.com/t/how-to-run-script-after-asset-import-into-level/624287/1 "2022-08-08T23:46:37Z")

</div>

At the moment I have a workflow problem with Unreal. I am using blender to sculpt some terrain (not a 2d heightfield just a typical 3d mesh) and place objects like trees, rocks and in-game items about. I run “import into level” and everything shows up under a single prefab, great! However, I need to perform manual steps to get the imported prefab + contents to behave properly for my game. Some steps include setting up the collision mesh properties (just uses the mesh as the collider), marking as block dynamic and then adding components for special named objects like “PlayerStart” or “PickUp”. I’m looking to hook in hopefully via c++, or python, so that after I export my FBX file in blender my custom asset importer catches the event and I can then automatically rig up things as desired via code.

Using the existing terrain tools is not viable for my design goals; please keep in mind that if answering 🙂

---

<div class="post-metadata">

**Author:** ![SupportiveEntity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SupportiveEntity](https://forums.unrealengine.com/u/SupportiveEntity)\
**Post date:** [August 9, 2022, 12:24am UTC](https://forums.unrealengine.com/t/how-to-run-script-after-asset-import-into-level/624287/2 "2022-08-09T00:24:32Z")

</div>

Hey @oldhighscore, I see you’re looking to get into editor scripting! It’s great for getting your pipeline set up just right, I wish I had more specialized content to help out with, but in this case the documentation should point you in a good starting direction, from there you’ll have to get a bit more specific. I couldn’t find a baseline way to catch calls for say imports, but this will allow you to make operations to run on them once they are in. Hopefully this starting point helps out!

> **[Scripting the Unreal Editor Using Python](https://docs.unrealengine.com/5.0/en-US/scripting-the-unreal-editor-using-python/)**
>
> Describes how to use Python in the Unreal Editor to script content production tasks.

---

<div class="post-metadata">

**Author:** ![oldhighscore](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@oldhighscore](https://forums.unrealengine.com/u/oldhighscore)\
**Post date:** [August 10, 2022, 8:08pm UTC](https://forums.unrealengine.com/t/how-to-run-script-after-asset-import-into-level/624287/3 "2022-08-10T20:08:18Z")

</div>

This set me on the right path, thanks!

```auto
import unreal
al = unreal.EditorAssetLibrary()
tas = al.load_asset("/Game/TestAsset")
tas.set_editor_property("complex_collision_mesh",tas)
bs = tas.get_editor_property('body_setup')
bs.set_editor_property('collision_trace_flag',unreal.CollisionTraceFlag.CTF_USE_COMPLEX_AS_SIMPLE)
al.save_loaded_asset(tas)

```
