# Could add a sub-level to current level with python?

**URL:** <https://forums.unrealengine.com/t/could-add-a-sub-level-to-current-level-with-python/470235>\
**Category:** Editor Scripting\
**Tags:** Python, streaming-level, unreal-engine, question\
**Created:** [August 24, 2020, 6:56am UTC](https://forums.unrealengine.com/t/could-add-a-sub-level-to-current-level-with-python/470235 "2020-08-24T06:56:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![5775486f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@5775486f](https://forums.unrealengine.com/u/5775486f)\
**Post date:** [August 24, 2020, 6:56am UTC](https://forums.unrealengine.com/t/could-add-a-sub-level-to-current-level-with-python/470235/1 "2020-08-24T06:56:02Z")

</div>

Here is a function called : create\_new\_streaming\_level

in [unreal.EditorLevelUtils — Unreal Python 4.27 (Experimental) documentation](https://docs.unrealengine.com/en-US/PythonAPI/class/EditorLevelUtils.html)

But could create a sub-level by existing level?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_6952327c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6952327c](https://forums.unrealengine.com/u/anonymous_user_6952327c)\
**Post date:** [October 20, 2020, 5:47pm UTC](https://forums.unrealengine.com/t/could-add-a-sub-level-to-current-level-with-python/470235/2 "2020-10-20T17:47:20Z")

</div>

Hi there.  
Yeah, that’s possible.  
Use the following format (Change the level\_path with your level path of the level you would like to add):

```
level_path = "/Game/Maps/Test"
unreal.EditorLevelUtils.create_new_streaming_level(unreal.LevelStreaming, new_level_path = level_path)

```

---

<div class="post-metadata">

**Author:** ![5775486f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@5775486f](https://forums.unrealengine.com/u/5775486f)\
**Post date:** [April 9, 2021, 8:47am UTC](https://forums.unrealengine.com/t/could-add-a-sub-level-to-current-level-with-python/470235/3 "2021-04-09T08:47:47Z")

</div>

Using this function would create a new level, couldn’t using existing level

---

<div class="post-metadata">

**Author:** ![5775486f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@5775486f](https://forums.unrealengine.com/u/5775486f)\
**Post date:** [April 9, 2021, 8:51am UTC](https://forums.unrealengine.com/t/could-add-a-sub-level-to-current-level-with-python/470235/4 "2021-04-09T08:51:13Z")

</div>

1. should open this level , or engine will crash

2.using unreal.EditorLevelUtils.add\_level\_to\_world to add existing level

```
tarLevelPath = "/Game/Maps/Test"
unreal.EditorLoadingAndSavingUtils.load_map(sourLevel.get_path_name())
world = unreal.EditorLevelLibrary.get_editor_world()
ue.EditorLevelUtils.add_level_to_world(world,tarLevelPath,unreal.LevelStreamingAlwaysLoaded)
ue.EditorLevelLibrary.save_current_level()

```

could use unreal.LevelStreamingDynamic instead unreal.LevelStreamingAlwaysLoaded

---

<div class="post-metadata">

**Author:** ![AngeLiskoDema](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AngeLiskoDema](https://forums.unrealengine.com/u/AngeLiskoDema)\
**Post date:** [April 8, 2024, 10:19am UTC](https://forums.unrealengine.com/t/could-add-a-sub-level-to-current-level-with-python/470235/5 "2024-04-08T10:19:31Z")

</div>

Hello, anyone knows how to remove a level in the current scene instead? I’m new here so I hope it’s ok to ask on this post, thanks in advance
