# Using template functions with the inline plugin

**URL:** <https://discourse.beets.io/t/using-template-functions-with-the-inline-plugin/1267>\
**Category:** Help\
**Created:** [May 8, 2020, 9:05am UTC](https://discourse.beets.io/t/using-template-functions-with-the-inline-plugin/1267 "2020-05-08T09:05:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kdbruin](https://avatars.discourse-cdn.com/v4/letter/k/9de053/32.png) [@kdbruin](https://discourse.beets.io/u/kdbruin)\
**Post date:** [May 8, 2020, 9:05am UTC](https://discourse.beets.io/t/using-template-functions-with-the-inline-plugin/1267/1 "2020-05-08T09:05:13Z")

</div>

I was wondering if it is possible to use template functions with the inline plugin. I want to use %the{} to get the proper first initial of an artist. Something like:

```
item_fields:
    initial: (albumartist_sort or artist_sort or albumartist or artist or '_')[0].upper()

```

But I would like to use the %the{} template function on the various artist fields first.

---

<div class="post-metadata">

**Author:** ![adrian](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/adrian/32/4_2.png) [@adrian](https://discourse.beets.io/u/adrian)\
**Post date:** [May 8, 2020, 12:02pm UTC](https://discourse.beets.io/t/using-template-functions-with-the-inline-plugin/1267/2 "2020-05-08T12:02:18Z")

</div>

Hello! There is no easy/convenient way, but the fact is that it’s possible to do _anything_ in inline snippets because they can run arbitrary Python code. Using the multi-line syntax, you can do something like this:

```auto
import beets.plugins
the_func = beets.plugins.template_funcs()['the']
return the('some string')

```

---

<div class="post-metadata">

**Author:** ![kdbruin](https://avatars.discourse-cdn.com/v4/letter/k/9de053/32.png) [@kdbruin](https://discourse.beets.io/u/kdbruin)\
**Post date:** [May 8, 2020, 3:09pm UTC](https://discourse.beets.io/t/using-template-functions-with-the-inline-plugin/1267/3 "2020-05-08T15:09:55Z")

</div>

Changed my code to

```
initial: |
    import beets.plugins
    the_func = beets.plugins.template_funcs()['the']
    the_artist = the_func(albumartist_sort or artist_sort or albumartist or artist or '_')
    return the_artist[0].upper()

```

And this works like a charm. Thanks!
