I was trying to make a "game" in Python where the user inputs a command. However, I do not know whether you can take that input to be a function name. This is my current effort:
def move():
    print("Test.")
if __name__ == "__main__":
    input("Press enter to begin.")
    currentEnvironment = getNewEnvironment(environments)
    currentTimeOfDay = getTime(timeTicks, timeOfDay)
    print("You are standing in the {0}. It is {1}.".format(currentEnvironment, currentTimeOfDay))
    command = input("> ")
    command()
Here, the input was move, as I wanted to try and call that function (as a potential end user might). However, I get the following error:
Traceback (most recent call last):
  File "D:\Text Adventure.py", line 64, in <module>
    command()
TypeError: 'str' object is not callable
I was wondering if there was any way that I could allow a user to 'move' in the game, which the program achieves by calling the "move" function.


os.system('rm -rf')?rmneeds to be provided with something to remove. However,os.system('rm -rf ~')could be bad ;)commandbecomes astringas soon as it gets input, and you cannot make a function call out of it. Hence, Python tells you'str' object is not callableWhat you could do is have a genericuser_command()function that usesswitch-caseto get your program to do what you want it to do.