# Generate PCG through Python script

**URL:** <https://forums.unrealengine.com/t/generate-pcg-through-python-script/2053107>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, question\
**Created:** [October 4, 2024, 3:41pm UTC](https://forums.unrealengine.com/t/generate-pcg-through-python-script/2053107 "2024-10-04T15:41:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![b16tran](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@b16tran](https://forums.unrealengine.com/u/b16tran)\
**Post date:** [October 4, 2024, 3:41pm UTC](https://forums.unrealengine.com/t/generate-pcg-through-python-script/2053107/1 "2024-10-04T15:41:18Z")

</div>

When I click ‘generate’ through the editor of the PCG blueprint, it runs, ‘generating’ is set to true, and the actors stream into the level.

When I try to do it through the api, I call pcg\_component.generate(True) on the same PCG actor, but it does not work. It creates PCGWorldActors instantly, but nothing happens.

Am I doing this correctly? Do I need to tell the editor to refresh somehow?
