After completing the module on classes, I decided to try and implement them in my game that I’m creating, but I’m stuck trying to figure out how to pass an object between functions that are in separate files (modules)?
File "main.py", line 64, in <module> menu() File "main.py", line 49, in menu debug.menu(newPlayer) File "/home/bran/Dungeon-Quest/debug.py", line 37, in menu player.find_potions() AttributeError: 'module' object has no attribute 'find_potions'
I know that to call a method of a class from within the module (?) it exists in is as simple as object.method() but I’m confused on how to do it from outside that module. Since my object newPlayer is instantiated within main.py and debug.py is imported and called from within main.py do I need to explicitly pass the object to the debug function as an argument?
Also how do I access the methods of the object from within the debug function? This is what really confused me since I’m not sure whether I should use the object name (newPlayer) or the class name (actions) or the module name along with the class name (player.actions).
Here’s my GitHub repo: https://github.com/brando56894/Dungeon-Quest