There has been a indication else where on the forum that because dynamo is using the idling event this then means revit will not allow the OpenAndActivateDocument API method to change the active document.
If you use the API Method in a macro or revit addin then you should be able to utilise this method and change the active document