Getting the error: "“Cannot find reference ‘xbee’ in ´__init__.pyi´"

Hello

I am trying to make a simple script for my Xbee3 module, and I took the code (xbee-python/examples/communication/ReceiveDataSample/ReceiveDataSample.py at master · digidotcom/xbee-python · GitHub) and I am now getting the error “Cannot find reference ‘xbee’ in ´__init__.pyi´:
from digi.xbee.devices import XBeeDevice

Any idea what I need to change? I assume it’s micropython looking for the library in the wrong place or something akin to that?

Picture1

I hope the above image gives any clarity to the issue.

I appreciate any help I can get! :smiley:

1 Like

I would suggest looking at the examples in PyCharm. In this case, you would simply want to import xbee and import time.

import xbee
import time

This is a copy of my answer to your question on Stack Overflow.

You’re in the wrong repository. Those Python files are for Digi gateway products.

The XBee 3 products use MicroPython, and you’ll want to make use of the xbee-micropython repository instead. Per the README for that repo, you might also want to use the Digi XBee PyCharm IDE Plugin for development.

1 Like

Remove the .py extension on your import statement so that it is specified as the following:

from digi.xbee.devices import xBeedevice

Tom Collins is correct and I should have caught it. You are using the Python repository for the Gateway products and not the Micro Python repository which is for the Modules.