I have a class named TEST in a configuration file config.py as follows:
# file config.py
class TEST():
alpha = 0.05
and a file run.py from which I try to access attributes of the class TEST through input argument as follows:
# file run.py
import sys
import config
if __name__ == "__main__":
conf = sys.argv[1] # comes from input argument conf=TEST
obj1 = config.TEST() # this works
print(obj1.alpha) # prints alpha variable 0.05
obj2 = config.conf() # AttributeError: module 'config' has no attribute 'conf'
print(obj2.alpha)
By running it as python3 run.py TEST, it gives attribute error in obj2, as it cannot convert the conf variable to TEST and access the class TEST. Any idea how to solve this?