I'm trying to make a command prompt style program in Python. I want to have a list of possible functions to run, and then check the list; if any of them match, take the input that matched and call a function with the same name. I currently get a "str" object is not callable
error.
import os
import time
able_commands = ["clear", "test"]
def test():
print("worked")
def run_command(command):
command()
input_command()
def clear():
print("clearing...")
time.sleep(2)
os.system('cls')
def input_command():
command = input(os.path.abspath(os.sep) + " ")
check_if = command.lower()
if check_if in able_commands:
run_command(check_if)
elif check_if == "":
input_command()
else:
print("ERROR \nPlease specify a valid command")
input_command()
input_command()
I'm a beginner with Python.