<p>The easiest way to use <code>pybricksdev</code> is as a command line tool. I recommend using <a href="https://pypa.github.io/pipx/" rel="nofollow noreferrer">pipx</a> to ensure that your are always using the latest version of <code>pybricksdev</code>.</p>
<p>Assuming you have already installed <code>pipx</code> and you have a terminal open in VS Code in the same directory as the script you want to run, run the following command:</p>
<pre><code>pipx run pybricksdev run ble my_script.py
</code></pre>
<p>Where <code>my_script.py</code> is replaced with the actual name of the script you want to run.</p>

CC BY-SA 4.0
2023-05-09T22:57:13.483Z
2023-05-09T22:57:13.483Z
David Lechner
<p>I'm trying to send some data from the hub to the terminal for some debug. But I can't figure out how I can connect the hub via Bluetooth to my PC. I tried to look in the <a href="https://docs.pybricks.com/projects/pybricksdev/en/latest/api/ble/index.html" rel="nofollow noreferrer">API documentation</a> and maybe I found something but I'm not sure.</p>

CC BY-SA 4.0
2023-03-28T07:30:20.353Z
Pybricks is great, so is the support they provide, I think you'd be better of asking your question there: https://github.com/pybricks/support/
Michael Verschaeve
CC BY-SA 4.0
2023-03-28T07:31:44.130Z
Hi tom and welcome to Bricks.SE! Can you show us what have you tried and how did it fail?
zovits
<programming><bluetooth><spike-prime><pybricks>
How I can connect the LEGO SPIKE Prime hub via Bluetooth in Visual Studio Code using the pybricksdev library?
tom
# How I can connect the LEGO SPIKE Prime hub via Bluetooth in Visual Studio Code using the pybricksdev library?

(Asked by: username_0 on 2023-03-28)

I'm trying to send some data from the hub to the terminal for some debug. But I can't figure out how I can connect the hub via Bluetooth to my PC. I tried to look in the [API documentation](https://docs.pybricks.com/projects/pybricksdev/en/latest/api/ble/index.html) and maybe I found something but I'm not sure.

**Tags:** programming, bluetooth, spike-prime, pybricks

> **Comments:**
> **username_1**: Pybricks is great, so is the support they provide, I think you'd be better of asking your question there: https://github.com/pybricks/support/  
> **username_2**: Hi username_0 and welcome to Bricks.SE! Can you show us what have you tried and how did it fail?  

---

## 1 answers

### Answer by username_3 on 2023-05-09. Score: 1

The easiest way to use pybricksdev is as a command line tool. I recommend using pipx to ensure that your are always using the latest version of pybricksdev.
Assuming you have already installed pipx and you have a terminal open in VS Code in the same directory as the script you want to run, run the following command:
pipx run pybricksdev run ble my_script.py

Where my_script.py is replaced with the actual name of the script you want to run.


---

