0

I have script in Python containing several functions, and one Callback (when event occurs). I would like to release some "package" from my script , which could be importable and usable for other users. Lets say: Some one can use it for creating GUI app in JAVA, another it will incorporate to his own C++ Gui app, and someone just will call my functions from another Python script.

Can you point me to right direction please?

Thanks.

1
  • Maybe LazyLoading ? Commented Feb 10, 2021 at 9:01

1 Answer 1

1

So you want to be able to call Python functions from Python, Java and C++?

  1. The Python case is just a matter of importing your module.
  2. To call Python functions from Java, try Jython: https://www.jython.org/index.html
  3. To call Python functions from C++, use the Python header files and this approach https://docs.python.org/3/extending/embedding.html. Alternatively, you can use Boost.Python: http://www.boost.org/doc/libs/release/libs/python/doc/index.html

Calling one language from another can be quite a tricky thing. An approach that would work in all languages and avoid major headaches would be to expose a proper public interface (command-line, http, etc) and consume this interface in the other languages.

Other references:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.