Issue
I'm using PyCharm and Python 3.10. I've had a constant, API_TOKEN, defined with an assignment statement in a separate file, constants.py and imported it with:
/>
from constants import API_TOKEN
That has been working.
I'd like to add more "importable" constants to constants.py; just to make sure that would work, before adding them I changed the import statement to
import contants
That single change caused PyCharm to generate an Unresolved reference 'API_TOKEN' error on each of the two references, and an Unused import statement 'import constants' warning.
Solution
After making the change to the import I neglected to add constants. to the references. So:
import constants
...
constants.API_TOKEN # use the value
Thanks to @wkl for the answer in a comment to the question!
Answered By - brec Answer Checked By - Robin (Python.Easybugfix Admin)
Post a Comment
Post a Comment