I have a class in globals.py as:
#!/usr/bin/env python
class fg():
def red(text): return f'\033[00;49;031m{text}\033[0m'
def heading(text): return red(text)
and I have the testrun.py script as:
#!/usr/bin/env python
from globals import fg
# Command 1:
print(fg.red("My text"))
# prints as expected
# Command 2:
print(fg.heading("My text"))
# throws the error: NameError: name 'red' is not defined
The question is how can call red function within the heading function.