# How to communicate between a UXP plug-in and a Python module?

**URL:** <https://forums.creativeclouddeveloper.com/t/how-to-communicate-between-a-uxp-plug-in-and-a-python-module/4370>\
**Category:** UXP Plugin API\
**Tags:** uxp\
**Created:** [March 4, 2022, 8:20pm UTC](https://forums.creativeclouddeveloper.com/t/how-to-communicate-between-a-uxp-plug-in-and-a-python-module/4370 "2022-03-04T20:20:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rosa\_borgoglio](https://avatars.discourse-cdn.com/v4/letter/r/9dc877/32.png) [@rosa\_borgoglio](https://forums.creativeclouddeveloper.com/u/rosa_borgoglio)\
**Post date:** [March 4, 2022, 8:20pm UTC](https://forums.creativeclouddeveloper.com/t/how-to-communicate-between-a-uxp-plug-in-and-a-python-module/4370/1 "2022-03-04T20:20:08Z")

</div>

Hi there! I am looking for the best strategy to create a channel of communication between a Photoshop UXP plug-in and a Python module. They will be both be running on the same machine. The plug-in needs to send some data to the Python module, the Python module will modify it slightly and send it back.

I would have done this using “child process”, but it has become clear that UXP does not support that functionality yet. What would be the best alternative?

---

<div class="post-metadata">

**Author:** ![kerrishotts](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/kerrishotts/32/8_2.png) [@kerrishotts](https://forums.creativeclouddeveloper.com/u/kerrishotts)\
**Post date:** [March 8, 2022, 4:43pm UTC](https://forums.creativeclouddeveloper.com/t/how-to-communicate-between-a-uxp-plug-in-and-a-python-module/4370/2 "2022-03-08T16:43:25Z")

</div>

You can use WebSockets for this functionality.

Python would be your web socket _server_ (this is the first link that Google gives me – so no promises on library quality: [websockets 10.2 documentation](https://websockets.readthedocs.io/en/stable/)), and then the UXP plugin would establish a connection as a client. Once a connection is established, communication is bi-directional.

The hardest part is establishing the server and communicating the port # to use. Right _now_ you have to rely on the Python side to be running, and once running to write a port # into the plugin’s data folder so that the plugin can pck that port # up and use it. (Or you can use a fixed port # – up to you.)

In the future, if your python side was registered with a URI scheme, UXP could launch it automatically if it wasn’t already running. (This will be in UXP 6.0. If you aren’t in the Ps prerelease - you should join – reach out to @Erin_Finnegan if you need assistance.)

---

<div class="post-metadata">

**Author:** ![nikshankarnoble](https://avatars.discourse-cdn.com/v4/letter/n/c6cbf5/32.png) [@nikshankarnoble](https://forums.creativeclouddeveloper.com/u/nikshankarnoble)\
**Post date:** [March 18, 2022, 4:26pm UTC](https://forums.creativeclouddeveloper.com/t/how-to-communicate-between-a-uxp-plug-in-and-a-python-module/4370/3 "2022-03-18T16:26:12Z")

</div>

Hi Kerri!

Are there any examples available of how to get a plugin to pick up a (fixed) port number?

I’m working on integrating PS into our facility’s pipeline and the majority of our tooling is Python based so this would be extremely helpful!

Many thanks,  
Nikhil

---

<div class="post-metadata">

**Author:** ![nikshankarnoble](https://avatars.discourse-cdn.com/v4/letter/n/c6cbf5/32.png) [@nikshankarnoble](https://forums.creativeclouddeveloper.com/u/nikshankarnoble)\
**Post date:** [March 18, 2022, 9:03pm UTC](https://forums.creativeclouddeveloper.com/t/how-to-communicate-between-a-uxp-plug-in-and-a-python-module/4370/4 "2022-03-18T21:03:17Z")

</div>

I just realised I’m apparently blind and missed the very obvious example here! 🤦🏼‍♂️

> **[uxp-photoshop-plugin-samples/io-websocket-example at main ·...](https://github.com/AdobeDocs/uxp-photoshop-plugin-samples/tree/main/io-websocket-example)**
>
> main/io-websocket-example
