I am trying to import some variables from a different python file resides in the same directory from a another python file.
been trying this thing for hours and I still couldn't get the variables to use.
I have two files in the same directory as below:
const.py
test.py
This is how const.py
looks like
FOO = 1234
NAMESPACE = "default"
DEPLOYMENT_NAME = "deployment-test"
DOCKER_IMAGE_NAME = "banukajananathjayarathna/bitesizetroubleshooter:v1"
SERVICE_CLUSTER = "deployment-test-clusterip"
SERVICE_NODEPORT = "deployment-test-nodeport"
INGRESS_NAME = "deployment-test-ingress"
and this is how my test.py
looks like:
import os
from . import constant
print(constant.FOO)
error I am getting:
ImportError: attempted relative import with no known parent package
Why is it so hard to do this with Python?