I am making an app in kotlin. But I know python a lot and made the logic in python. The kotlin is only used for the display. Is there a way to call a python function in kotlin?. A python script can call python scripts but can a Kotlin script call one?
I think there are two normal solutions.
Using Polyglot API of GraalVM ( https://www.graalvm.org/sdk/javadoc/org/graalvm/polyglot/package-summary.html ).
Creating a C interface implemented with Python ( https://www.linuxjournal.com/article/8497 ) and calling it with JNI ( https://docs.oracle.com/javase/8/docs/technotes/guides/jni/ ). However, this option needs you to manage your objects and memory very carefully (dispose all C pointers properly etc.)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.