I'm trying to append inputs to a list in another python file. I think I have the order correct but the error message I get is AttributeError: module 'inventory' has no attribute 'pick'
when I try it out.
main.py:
import inventory
choice = input("--> ")
if "inv pick" in choice:
inventory.pick()
inventory.py:
import main
backpack = []
def pick():
"""
Function for picking up things
"""
backpack.append(main.choice)
print(backpack)
If I make write the string "inv pick flower" end hit enter I get the error message instead of the printed content of the list 'Backpack'. Maybe I should use .extend instead of .append but neither of it works right now. Any pointers perhaps?
Regards