AttributeError: 'super' object has no attribute 'run'

Question:
I’m trying to remake GitHub - Matt-DESTROYER/textadventure: A small Python package to make creating your own text adventure games easy! but actual code. I have an Action class with a function called run.

I have other classes that inherit Action and I want to call the parent class (Action)'s run function.

I tried using super() which worked for super().__init__() but it’s not working with super().run()

I know run isn’t doing anything right now but in the future I will probably add stuff to it.

Repl link:
https://replit.com/@QwertyQwerty54/TextAdventures

Code snippet:

class Action:    
    def __init__(self) -> None:
        pass
    
    def run(self) -> None:
        pass


class Text:
    def __init__(self, text) -> None:
        super().__init__()
        self.text = text
    
    def run(self):
        super().run()
        print(self.text)

Try making Text inherit from Action

class Text(Action):
3 Likes

:laughing:

I really have no idea how I forgot that. I literally put it for the Options class.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.