I'm using pycharm if that matters. In one project, I have several python files and I'd like to use a set of constants across all of them. What is the pythonic way of doing that since my attempt fails for a reason unknown to me?
constants.py
WIDTH = 3
main.py
import constants
print(WIDTH)
This fails for unresolved reference WIDTH
Also, I have another project that I'd like to use the same constants in it. How is that typically handled since files are in different directories? I want to believe that there's a way to not duplicate the constants.py file.