0

So we have this massive Python project responsible for talking to a piece of hardware.

Currently we open up a python shell, import a bunch of the company's and python classes and run a bunch of commands to initialize the hardware. In the shell we then execute a bunch of functions loaded from our Python API passing in references of the initialized hardware we got from initialization.

We would like to be able to do the same thing via C++, and use it as a wrapper of sorts to send commands into a Python shell.

We cant just pass in scripts that initialize, get the hw reference, and then run some functions and end because the initialize part takes 5-10 seconds, so we want to keep the python instance alive that has the var's to communicate with the the initialized hardware so we can initialize once and then just send send function after function at the hardware at a much faster rate. I'd also like to be able to get the output back to C++.

Hopefully that makes sense what we are trying to do and why, if not let me know.

2
  • I recommend using c++ library in your python code. Commented Feb 9, 2017 at 5:07
  • Thats not possible unfortunately. We already have a C++ project and are looking for a way to use some functionality from this mammoth python project from within our current C++ tool. Commented Feb 9, 2017 at 21:10

1 Answer 1

0

You can extend Python with C++ easily. Or you can run two processes and use inter-process communication to using methods and functionalities.

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.