# Call Python script

**URL:** https://discourse.processing.org/t/call-python-script/42159
**Category:** Coding Questions
**Created:** [June 7, 2023, 4:01am UTC](https://discourse.processing.org/t/call-python-script/42159 "2023-06-07T04:01:00Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![doni](https://avatars.discourse-cdn.com/v4/letter/d/a698b9/32.png) [@doni](https://discourse.processing.org/u/doni)
#### Post date: [June 7, 2023, 4:01am UTC](https://discourse.processing.org/t/call-python-script/42159/1 "2023-06-07T04:01:00Z")

</div>

hi forum. is it possible to call python script from processing sketch. thank you

---

<div class="post-metadata">

### Author: ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)
#### Post date: [June 7, 2023, 10:42am UTC](https://discourse.processing.org/t/call-python-script/42159/2 "2023-06-07T10:42:48Z")

</div>

You could use **launch()**:

> **[launch() / Reference](https://processing.org/reference/launch_.html)**
>
> Attempts to open an application or file using your platform's launcher. The filename parameter is a String specifying the file name and location. The location parameter must be a full path name…

Or directly manipulate Java’s [Process](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Process.html) class as on this [example sketch link](https://forum.processing.org/two/discussion/23471/combining-two-pieces-of-code/):

> <https://github.com/GoToLoop/command/blob/patch-1/src/deadpixel/command/Command.java>

---

<div class="post-metadata">

### Author: ![hx2A](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/hx2a/32/14322_2.png) [@hx2A](https://discourse.processing.org/u/hx2A)
#### Post date: [June 12, 2023, 7:46pm UTC](https://discourse.processing.org/t/call-python-script/42159/4 "2023-06-12T19:46:19Z")

</div>

This won’t work if you use the Processing PDE, but you can use py5 to make arbitrary calls from Processing to Python.

[https://py5coding.org/content/processing\_mode.html](https://py5coding.org/content/processing_mode.html)

py5’s Processing mode adds a `callPython()` method to Processing. You can pass Java objects to Python and the Python code can return Python objects back to Java.

The example code in this folder will help you:

> **[py5-python-and-java/processing-mode at main · py5coding/py5-python-and-java](https://github.com/py5coding/py5-python-and-java/tree/main/processing-mode)**
>
> main/processing-mode
