I have the below project structure in Linux.
main_project
├── base_dir
│   └── helper
│       └── file_helper.py
│       └── __init__.py
    └── jobs
        └── adhoc_job.py
        └── __init__.py
        └── test_job.py
        └── __init__.py     
In helper/file_helper.py script I have below block of code
def null_cols_exception(df, cols_to_check):
    """
    :param df: data frame on which the function has to be applied
    :param cols_to_check: columns to check
    :return:
    """
    for i in cols_to_check:
        excpt_cd = globals()[i + '_null_exception_code']
        print(excpt_cd) 
        
        # There is some logic here but for test purpose removed it
        # Here the data gets overwritten in LOOP I have covered that scenario but for test purpose removed it
        
        
Now I am using this function jobs/adhoc_job.py script
from helper.file_helper import null_cols_exception
test_col_null_exception_code = 123
test_col2_null_exception_code = 999
null_cols = ['test_col', 'test_col2']
# calling the null_cols_exception function
null_df = null_cols_exception(test_df, null_cols)
Now when I run the jobs/adhoc_job.py script
I am getting below error at the below point
        excpt_cd = globals()[i + '_null_exception_code']
    KeyError: 'test_col_null_exception_code'
    
Basically the function is unable to derive the test_col_null_exception_code variable
How can I resolve this issue
 
    