Barry Byford has a useful and continually growing introduction to using Bluetooth on Linux. He describes how to use BlueZ, the official Bluetooth stack on Linux, via D-Bus and Python. D-Bus allows communication between multiple processes running concurrently on the same machine. There’s an example how to set up an asynchronous event loop and how to build a Bluetooth Low Energy (BLE) device implementing the Bluetooth Central role.
While you are there, also take a look at Barry’s notes and examples on Creating a BlueZ Pairing Agent and Bluez beacons on the command line.