> For the complete documentation index, see [llms.txt](https://bkortbus.gitbook.io/unreal-python-recipe-book/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bkortbus.gitbook.io/unreal-python-recipe-book/assets/calling-bp-graph-functions.md).

# Calling BP Graph Functions

How to call a function declared in the Blueprint Editor

<figure><img src="https://368271246-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FStUBkBT2qJGKNkIZ6yc7%2Fuploads%2F0k3fZhKhOyf61xxTKCmc%2Fimage.png?alt=media&amp;token=cca42fb5-ca81-4c9b-aa0b-051034bc20e2" alt="" width="563"><figcaption></figcaption></figure>

For Blueprint functions created in the Blueprint Editor we can use `call_method()` to access them via Python:

```python
asset_instance.call_method("function")
```

For functions with inputs we can use either the <mark style="color:green;">args</mark> or <mark style="color:green;">kwargs</mark> parameters:

<pre class="language-python"><code class="lang-python"><strong>asset_instance.call_method("function", args=("inputs_as_a_tuple",))
</strong>asset_instance.call_method("function", kwargs={"arg": "value"})
</code></pre>

It also works with Blueprint functions that have returns:

```python
value = asset_instance.call_method("function_with_return")
```

call\_method also works with custom events:

<figure><img src="https://368271246-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FStUBkBT2qJGKNkIZ6yc7%2Fuploads%2FqCE59TJfH4efd8804Ap2%2Fimage.png?alt=media&amp;token=70b11d09-4df1-4f42-9ddf-dc00745abf27" alt="" width="478"><figcaption></figcaption></figure>

{% hint style="danger" %} <mark style="color:yellow;">Note</mark>:  An asset loaded using `unreal.load_asset()` does not have direct access to call methods defined in the Blueprint Graph, we will need to get either its default object or an active instance of the BP:

```python
asset_instance = unreal.new_object(asset.generated_class())
# or 
default_object = unreal.get_default_object(asset.generated_class())
```

{% endhint %}
