Is it possible to use the Open Babel Python module in Unity?

I am designing a game in which I would like to simulate chemical reactions using the SMILES notation interpreter Open Babel, which comes as a Python module. I have heard of people getting various versions of Python to work for scripting in Unity, but I am wondering if anyone thinks it would be possible to use a module like Open Babel in Unity scripts. The Open Babel Python module is described in detail here.

If anyone has an idea as to how this could work or has heard of anyone doing anything similar, please let me know!

It’s almost certainly possible, but it will require a significant amount of fiddling (which is why I haven’t bothered just to prove the point). Note that the Python module for this thing still calls a library installed with the OpenBabel GUI, so it’s not entirely self-contained (which adds more fiddling with the install).

To answer your question explicitly: if you can get that module to work with the natively installed version of CPython (2.7.x) on your system, then connecting that to Mono/Unity through Python for .NET will probably get you where you want.

That said, the OpenBabel site includes libraries for .NET directly and that might be a better route given Unity is built on Mono and .NET. If you’re on Windows then this should definitely be considered and even if you’re not then it should still be considered. Doing it in Python is going to involve spending a decent amount of time on the command line. There is no way around that (yet).