# Adding episode to tk-flame-export

**URL:** <https://community.shotgridsoftware.com/t/adding-episode-to-tk-flame-export/15637>\
**Category:** Pipeline Integrations\
**Tags:** fptr-tk\
**Created:** [July 8, 2022, 8:08pm UTC](https://community.shotgridsoftware.com/t/adding-episode-to-tk-flame-export/15637 "2022-07-08T20:08:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wes.j](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/wes.j/32/5032_2.png) [@wes.j](https://community.shotgridsoftware.com/u/wes.j)\
**Post date:** [July 8, 2022, 8:08pm UTC](https://community.shotgridsoftware.com/t/adding-episode-to-tk-flame-export/15637/1 "2022-07-08T20:08:59Z")

</div>

Hello all!

Been getting into the thick of the toolkit code but am having trouble setting up a schema using Episode as the parent entity for Shots as opposed to Sequence.  
The reason for this is to match our existing folder structure which is organized by episode. The episode name the first token in our sequence name.

I am working with the tk-flame-export toolkit. I have defined Episode in templates.yml and replaced Sequence in the corresponding templates. Also, I have found the relevant portion in the export\_preset.py where the template\_defs are replaced.

I believe I need to change the “shot\_parent\_entity\_type” but do not know where that setting is. But I am still confused as to why the Episode field from the templates.yml is not working with this line:

```auto
template_defs[t] = template_defs[t].replace("{Episode}", "<name>")

```

Any help is much appreciated! Also it seems difficult to switch from the Sequence based setup. Is switching to Episode / a different shot\_parent\_entity ill-advised? What other difficulties will I encounter if change the default structure?

Thank you!

 ![Flame_Error](https://global.discourse-cdn.com/shotgunsoftware/original/2X/f/f3627fd27be91e407c7d46f81f7d95032b61198c.png)

---

<div class="post-metadata">

**Author:** ![Ricardo\_Musch](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/ricardo_musch/32/405_2.png) [@Ricardo\_Musch](https://community.shotgridsoftware.com/u/Ricardo_Musch)\
**Post date:** [July 12, 2022, 3:03pm UTC](https://community.shotgridsoftware.com/t/adding-episode-to-tk-flame-export/15637/2 "2022-07-12T15:03:28Z")

</div>

if you have an `entity` field on the Shot where you link to the episode entity for that shot you could add a key to tempates.yml to resolve it from the Shot context.

templates.yml - keys:

```auto
    ShotEpisode:
        type: str
        shotgun_entity_type: Shot
        shotgun_field_name: sg_episode.Episode.code

```

Where `sg_episode` is the field name on your Shot entity.  
This uses deep linking to get the `Episode` entity linked on the Shot and the `code` field from that entity link.

Then use `ShotEpisode` as a key in your path.

---

<div class="post-metadata">

**Author:** ![wes.j](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/wes.j/32/5032_2.png) [@wes.j](https://community.shotgridsoftware.com/u/wes.j)\
**Post date:** [July 12, 2022, 3:26pm UTC](https://community.shotgridsoftware.com/t/adding-episode-to-tk-flame-export/15637/3 "2022-07-12T15:26:19Z")

</div>

Thank you very much! I will give this a go.

---

<div class="post-metadata">

**Author:** ![Ricardo\_Musch](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/ricardo_musch/32/405_2.png) [@Ricardo\_Musch](https://community.shotgridsoftware.com/u/Ricardo_Musch)\
**Post date:** [July 12, 2022, 10:35pm UTC](https://community.shotgridsoftware.com/t/adding-episode-to-tk-flame-export/15637/4 "2022-07-12T22:35:08Z")

</div>

In case you deeplink Episodes to Shots via a Sequence I think this may also work:

```
ShotEpisode:
    type: str
    shotgun_entity_type: Shot
    shotgun_field_name: sg_sequence.Sequence.sg_episode.Episode.code

```

In this case there is a field called `sg_sequence` on the `Shot` entity.  
The `sg_sequence` field links to a `Sequence` which has a field called `sg_episode` which links to the episode.
