This should, as you say work. In the Papyrus fragments for the Quest Stages you don't need to use kmyQuest or GetOwningQuest or anything like that.
Back to basics - is there a stage 2 in the Quest Objectives? Does this have a Display Text? Dunno if this would cause it to fail but perhaps the stage points to an invalid Target Alias?
If it still isn't working try:
SetObjectiveDisplayed(2)Debug.MessageBox("Stage 2 objective triggered!!!");Player has encountered Hooded ManDoes the message box appear?
Very good Idea for where to place a debug box. I'll try it. To answer your questions, Yes, there is an objective with Index '2' and it has text "Investigate the Invitation"
Been having so much problem with code, I enabled logging last night, and been trying it this morning to see if it helps. Gonna try putting that debug box in first. I'll let you know what I find.
EDIT: Neither the ObjectiveDisplayed was changed, or the Message box popped up. I double checked the Quest Vars. Using SQV, AFTER I set the stage to 2. It shows that the quest stage is indeed 2. For some reason though, my code is not being executed. Brb. Imma go look at the logs from the last run.
EDIT EDIT: Log Tells me nothing.
EDIT X3: Added a Debug.Trace() to the code with same text as debug box. Gonna run it again.
EDIT X4: The code in the quest stage fragment is clearly just not executing. There is something underlying in the engine. Something the got changed somehow, which is rendering all of my code useless. The Debug.Trace() function didn't write to the log either. There are only a few things that could be happening here:
a) The stage is set, and the engine cannot read the code (for some reason)

The stage is set, and the engine fails to initiate the quest script (with all the fragments on it)
c) The stage is set, and the engine fails to initiate this fragment of the quest script.
As I was saying before this problem is running throughout my mod right not. I have lines of code at various places in my mod which worked fine a day a go. They compile properly, and have worked properly in the past, but something has changed, and while the code still compiles correctly, it is no longer executed in game.