I understand that a lot of time has passed, but maybe you remember, is it possible to set up the code so that it automatically triggers when a certain event occurs? For example, when morning comes
So, the short answer is yes, but to my knowledge (admittedly as someone who's more versed in coding in general rather than Ren'Py specifically I may be overlooking some better method to do this), there's not a way to do that without actually adjusting the game's code. While you can make whatever function you want in its own file, you will need to insert a call to that function in whatever event(s) you want to have call it.
For your example of wanting to call something every morning, make a function with all the adjustments you desire to occur each morning as described in the post you quoted. Then, you'll need to extract the script files from the archive.rpa (which I explained how to do in
this post about adding outfits to the game). For something to trigger every morning, you'll want the script Functions.rpy, and can delete all the other extracted files as they'll be irrelevant for what you're doing (though if you want to add triggers in other events you'll need to keep the files containing them). The code for a new day is in the Wait/Sleep Cycle code, so search for "label Wait" without quotes, and then scroll down a little to find where it the part with "$ Day += 1" (or just search for that directly). Within that section, say immediately above or below the code to adjust the day (though in truth it just needs to be within that area of matching indentation), add your function (make sure you match indentation level and that you use spaces rather than tabs).
Save the file, then every time a new day occurs, it should run your function. Mind, it's possible there might be something later in the wait function that resets some value or other, so if that is the case, you'll want to skim through there to find where that happens and place your function after it (also making sure that it will still only trigger at the start of the day rather than every time the game moves to the next time slot).
In the future, when the game updates, you'll be able to just bring over your file with the functions you made, but to be safe, you'll want to re-do the process of adding the calls to said functions for automation, as Oni might have made changes to the given script that you are adjusting.