I have a problem in my python code. I want to execute functions that are in classes in a file called (functions.py). If I run the main file (main.py), the functions will not work.
Project root:
.________ main.py
project |
|________ functions.py
main.py
import functions
import time
print("Hello World")
time.sleep(1)
functions.clear()
functions.py
import time
import os
import sys
import math
class color:
PURPLE = "\033[95ml"
BLACK = "\033[30m"
CYAN = "\033[96m"
DARKCYAN = "\033[36m"
BLUE = "\033[94m"
GREEN = "\033[92m"
YELLOW = "\033[93m"
RED = "\033[91m"
BOLD = "\033[1m"
UNDERLINED = "\033[4m"
MAGENTA = "\033[35m"
GREY = "\033[90m"
ITALIC = "\033[3m"
END = "\033[0m"
class functions:
def clear():
if os.name == "nt":
os.system("cls")
else:
os.system("clear")
def animation(text):
for letter in text:
time.sleep(0.01)
sys.stdout.write(letter)
sys.stdout.flush()
class mathematics:
def add(a, b):
print(a + b)
def subtract(a, b):
print(a - b)
def multiply(a, b):
print(a * b)
def divide(a, b):
print(a / b)
class colors:
def red_text(text):
print(f"{color.RED}{text}{color.END}")
def blue_text(text):
print(f"{color.BLUE}{text}{color.END}")
def yellow_text(text):
print(f"{color.YELLOW}{text}{color.END}")
def purple_text(text):
print(f"{color.PURPLE}{text}{color.END}")
def cyan_text(text):
print(f"{color.CYAN}{text}{color.END}")
def darkcyan_text(text):
print(f"{color.DARKCYAN}{text}{color.END}")
def green_text(text):
print(f"{color.GREEN}{text}{color.END}")
def black_text(text):
print(f"{color.BLACK}{text}{color.END}")
def magenta_text(text):
print(f"{color.MAGENTA}{text}{color.END}")
class markdown:
def bold_text(text):
print(f"{color.BOLD}{text}{color.END}")
def underlined_text(text):
print(f"{color.UNDERLINED}{text}{color.END}")
def italic_text(text):
print(f"{color.ITALIC}{text}{color.END}")
def highlight_text(text):
print(f"{color.HIGHLIGHT}{text}{color.END}")
def ready():
functions.animation(f"{color.RED}You are using the Print-functions library by W1L7{color.END}")
time.sleep(1)
functions.clear()
ready()
If I run the code, it print this:
I don't know how to fix my error. Please be kind. I'm not advanced in python.

functions, not callfunctions.cleardirectly.class functions:in your code, why have you written this, and what do you think it does?