# How to change PCG graph parameters from python?

**URL:** <https://forums.unrealengine.com/t/how-to-change-pcg-graph-parameters-from-python/2060532>\
**Category:** Editor Scripting\
**Tags:** unreal-engine, question\
**Created:** [October 9, 2024, 5:30pm UTC](https://forums.unrealengine.com/t/how-to-change-pcg-graph-parameters-from-python/2060532 "2024-10-09T17:30:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![robomojo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@robomojo](https://forums.unrealengine.com/u/robomojo)\
**Post date:** [October 9, 2024, 5:30pm UTC](https://forums.unrealengine.com/t/how-to-change-pcg-graph-parameters-from-python/2060532/1 "2024-10-09T17:30:09Z")

</div>

Hello, I have added a parameter “Density” to my PCG graph and I am having trouble changing its value from python.

I am creating volumes from code and then attempting to set the parameter values. Here is an example:

```auto
python
myAsset = unreal.load_asset('/Game/MyGraph')
myActor = unreal.EditorLevelLibrary.spawn_actor_from_object(myAsset, unreal.Vector(0.0, 0.0, 0.0))
propBag = myActor.pcg_component.graph_instance.get_editor_property("ParametersOverrides") # PCGOverrideInstancedPropertyBag
params = propBag.get_editor_property("parameters") # InstancedPropertyBag
paramsValue = params.get_editor_property("value") # InstancedStruct
paramsValue.set_editor_property("Density", 0.5) # NOT WORKING

```

The last line triggers an error, because paramsValue doesn’t have the editor property “Density”.

```auto
LogPython: Error: Traceback (most recent call last):
LogPython: Error: File "<string>", line 6, in <module>
LogPython: Error: Exception: InstancedStruct: Failed to find property 'Density' for attribute 'Density' on 'InstancedStruct'

```

I’m new to using python in unreal and I’m doing this as an experiment. So I might be missing something obvious.

Can anyone help me set my “Density” parameter?
