# Assign context via python

**URL:** <https://forum.logik.tv/t/assign-context-via-python/14100>\
**Category:** Python\
**Tags:** batch\
**Created:** [February 8, 2026, 4:09pm UTC](https://forum.logik.tv/t/assign-context-via-python/14100 "2026-02-08T16:09:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jason\_Chambers](https://avatars.discourse-cdn.com/v4/letter/j/ecb155/32.png) [@Jason\_Chambers](https://forum.logik.tv/u/Jason_Chambers)\
**Post date:** [February 8, 2026, 4:09pm UTC](https://forum.logik.tv/t/assign-context-via-python/14100/1 "2026-02-08T16:09:17Z")

</div>

Is it possible to add/clear context views via Python?

If not directly then using assign next available context and clear all.

Thanks

---

<div class="post-metadata">

**Author:** ![philm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/philm/32/9286_2.png) [@philm](https://forum.logik.tv/u/philm)\
**Post date:** [February 8, 2026, 6:58pm UTC](https://forum.logik.tv/t/assign-context-via-python/14100/2 "2026-02-08T18:58:00Z")

</div>

[Context via Python - Discord](https://discord.com/channels/798315760215916605/1011615260702158908/1466823559744852184)  
[Context via Python - Flame Feedback](https://feedback.autodesk.com/project/feedback/view.html?cap=5afe6c845cb3447ab36ccbd7f0688f84&uf=0a2a7e28c23f41e09849e3f6932d75f1&new=1&ifps=-898&t=0&fti=2)

---

<div class="post-metadata">

**Author:** ![Jason\_Chambers](https://avatars.discourse-cdn.com/v4/letter/j/ecb155/32.png) [@Jason\_Chambers](https://forum.logik.tv/u/Jason_Chambers)\
**Post date:** [February 8, 2026, 8:18pm UTC](https://forum.logik.tv/t/assign-context-via-python/14100/3 "2026-02-08T20:18:26Z")

</div>

Thanks Phil,

I’ll look into that when I get some time

---

<div class="post-metadata">

**Author:** ![fredwarren](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/fredwarren/32/158_2.png) [@fredwarren](https://forum.logik.tv/u/fredwarren)\
**Post date:** [February 9, 2026, 12:49pm UTC](https://forum.logik.tv/t/assign-context-via-python/14100/4 "2026-02-09T12:49:21Z")

</div>

At the node level you can use the set\_context() function. You must pass an index and a socket name as arguments.

Then at the Batch level you can use the clear\_context() and clear\_all\_contexts() functions. The former needs an index as its sole argument.
