I am having a bit of an issue when it comes to one class inheriting another. As a simple example I have a class called Person, which contains generic information about a person object. This class is contained in it's own file called person.rpy. I have another class called Male, which contains specific information about a male character. This class is contained in it's own file called male.rpy. Both files are located in the same sub-folder (Objects) with in the project structure. I've included an empty __init__.py file within the Objects folder as well.
The code I currently have is this:
Code: Select all
$ from person import Person
init python:
class Male(Person):
def __init__(self, name, *args, **kwargs):
super().__init__(*args, **kwargs)
However, I receive the following error when launching the project:
Code: Select all
"NameError: name 'Person' is not defined".
I realize that I can solve the problem by nesting the Person class within the same file as the Male class. But that is sub-optimal as I have a Female class which also inherits from Person, and having multiple classes contained within the same file is an abhorrent coding practice.
So my question is this, am I improperly referencing the import, missing a step, or some otherwise messing it up myself, or is it a limitation of renpy that it cannot inherit from a class in a different file?