

i second the comment that you need to consider why you want to do this. You generally need a pretty good reason to split your codebase into multiple languages.
As far as actually doing it, you have a ton of different options, some of which have been mentioned here. Some i can think of off the top of my head:
- create a library (dll or so file or the like)
- set up a web server and use communication protocols (either web socket or rest API or the like)
- use a 3rd party communication/messaging framework like MQ or kafka or something
- create your own method of communication. Something like reading and writing to a file on disk, or a database and acting on the information plopped in
basically every approach is going to require you to come up with some sort of API that the two work together through, though, an API in the generic sense is basically a shared contract two disconnected pieces of code use to communicate.
Presumably, someone attempting to mug you would probably be a bandit (+3 to hit, +1 to damage), not another commoner