Changing variable from another class in verse

MyOtherClass:= class():
    ChangeMyInt():void=
    #what goes here to set/change the value of "MyInt" from "MyClass"?


MyClass := class(creative_device):

    var MyInt: int = 0

    OnBegin<override>()<suspends>:void=
        NewMyOtherClass:=MyOtherClass{}
        MyOtherClass.ChangeMyInt() 
          


So my question is what would I place in ChangeMyInt() to change the MyInt variable in MyClass

Side question: is it possible to avoid the “MyOtherClass.ChangeMyInt()” line, and appon creation of MyOtherClass, automatically call ChangeMyInt()

Might be a super basic question but im new :slight_smile:

You can put a block in a class body without a function and it’ll run on creation of the class. So you’d just replace “ChangeMyInt():void=” with “block:”. The only thing to know is that anything within the block needs to be “rollback”-able just like any function in a failure context.