# Render through python command wait until shaders have been compiled

**URL:** <https://forums.unrealengine.com/t/render-through-python-command-wait-until-shaders-have-been-compiled/455462>\
**Category:** Rendering\
**Tags:** gamemode, Python, Render, game-mode, unreal-engine, question\
**Created:** [September 17, 2019, 7:51am UTC](https://forums.unrealengine.com/t/render-through-python-command-wait-until-shaders-have-been-compiled/455462 "2019-09-17T07:51:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Terry](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Terry](https://forums.unrealengine.com/u/Terry)\
**Post date:** [September 17, 2019, 7:51am UTC](https://forums.unrealengine.com/t/render-through-python-command-wait-until-shaders-have-been-compiled/455462/1 "2019-09-17T07:51:16Z")

</div>

Hi,  
We are wanting to render a level sequence through a command but have that command wait until all the shaders have been complied. What would be the best way to do this? We are using game mode to render.

Should we simply be using a derived data cache? Or is there another way?

---

<div class="post-metadata">

**Author:** ![BlueMind\_Studio](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BlueMind\_Studio](https://forums.unrealengine.com/u/BlueMind_Studio)\
**Post date:** [September 17, 2019, 10:19am UTC](https://forums.unrealengine.com/t/render-through-python-command-wait-until-shaders-have-been-compiled/455462/2 "2019-09-17T10:19:19Z")

</div>

I can’t help you with pyton, but it sounds like it is all possible with just the commandline! Have look in the wiki [A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums](https://wiki.unrealengine.com/Sequencer_Batch_Rendering) and in the docs [https://docs.unrealengine.com/en-US/Engine/Sequencer/Workflow/RenderingCmdLine/index.html](https://docs.unrealengine.com/en-US/Engine/Sequencer/Workflow/RenderingCmdLine/index.html)  
to filling up the derived data cache use “UE4Editor.exe ProjectName -run=DerivedDataCache -fill” - I guess if you daisy chain those to commands it makes what you want.

ot, would be curious how your game mode looks like when you use it for render

---

<div class="post-metadata">

**Author:** ![Terry](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Terry](https://forums.unrealengine.com/u/Terry)\
**Post date:** [September 19, 2019, 1:27am UTC](https://forums.unrealengine.com/t/render-through-python-command-wait-until-shaders-have-been-compiled/455462/3 "2019-09-19T01:27:03Z")

</div>

Hi Andoh,  
Thanks for the tips. We had run the -fill and had the derived data cache set but still the shaders needed to compile. I’m thinking that having the -fill command run before every render might guarantee that it always works.

---

<div class="post-metadata">

**Author:** ![BlueMind\_Studio](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BlueMind\_Studio](https://forums.unrealengine.com/u/BlueMind_Studio)\
**Post date:** [September 19, 2019, 8:36am UTC](https://forums.unrealengine.com/t/render-through-python-command-wait-until-shaders-have-been-compiled/455462/4 "2019-09-19T08:36:36Z")

</div>

yes that sounds strange. normally shaders compile once, not every time you load the project. if it recompiles every time at your side something is wrong. do you have any logs? (Project/saved/logs folder)

---

<div class="post-metadata">

**Author:** ![ani\_kal](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ani\_kal](https://forums.unrealengine.com/u/ani_kal)\
**Post date:** [February 2, 2022, 8:19pm UTC](https://forums.unrealengine.com/t/render-through-python-command-wait-until-shaders-have-been-compiled/455462/5 "2022-02-02T20:19:47Z")

</div>

The following commands should do the trick

```auto
unreal.MaterialEditingLibrary.update_material_instance(unreal.EditorAssetLibrary.load_asset('some/path/mat_inst_const.mat_inst_const'))
unreal.MaterialEditingLibrary.update_material_function(unreal.EditorAssetLibrary.load_asset('some/path/mat_func.mat_func'))

```

---

<div class="post-metadata">

**Author:** ![ani\_kal](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ani\_kal](https://forums.unrealengine.com/u/ani_kal)\
**Post date:** [February 2, 2022, 8:49pm UTC](https://forums.unrealengine.com/t/render-through-python-command-wait-until-shaders-have-been-compiled/455462/6 "2022-02-02T20:49:01Z")

</div>

My experience is; in order for the above code to take effect… the following command also also needs to be called.

```auto
unreal.EditorAssetLibrary.save_loaded_asset(loaded_asset)

```

which the above seems to be pointless.
