Context Menu problem

How do I get a function to interact with the real scene when triggering the function from a context menu?
example:
void anAction::testFunction(){
dzScene->setFrame(1);
}
If I trigger this function from an Action (e.g. menu or event on a pane) it works fine.
However if I trigger this same function from a context menu on the viewport or hierarchyPane it interacts with a phantom copy of the scene, thus the dzScene will not change to frame one.
I guess for context menu items where update of the dzScene is required I need to promote the function as an action.
Comments
Ignore that.
Some sleep helps. I overlooked an "undo.cancel()" in my context menu calls.