Kotlin : Extend python


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


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


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.


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.


Yes. I know it but never use it


Maybe I need to learn Jython


I mean write python code inside a kotlin class