I have a basic scripts.rpy file in which I create an instance of the class:
And there is a separate file (game.rpy) in which this class is described:
Code: Select all
init python:
class Game:
def __init__(self):
pass
I get the error that "name 'Game' is not defined". The Init in the main file loads before the class "sees" it, and what's most annoying about Renpy (most annoying, inconvenient and horrible) is that Renpy crashes and closes. It always kills me... But that's not the point.
For python, you need to include additional files (modules) and I would do so at the beginning of the document:
But Renpy reads all files at once. But it turns out that they are read in order, so that when you try to create an instance of a class, it doesn't exist yet. How do I initialize the module first? I've seen something like "init python -1" or something like that, but I can't find an example or description of how that works.