Kotlin : Extend python


#1

Is there any possible way to write python code in kotlin code


#2

No, but both can interoperate on Jvm, do you know Jython?


#3

In fact there are two ways. One can use JSR-223 to use Jython code as string inside Java/Kotlin code, and you can use GraalVM polyglot features.

In general, I would think twice before using either of those approaches.


#4

I don’t understand the question part exactly, but based on the post title it should be noted that Kotlin Native can be used to write Python extensions just as you would in C/C++. There would be some effort into getting the C FFI right, but it’s doable.


#5

Yes. I know it but never use it


#6

Maybe I need to learn Jython


#7

I mean write python code inside a kotlin class