What is the code that you are using?
One thing you could do (I’m shooting in the dark here somewhat, not knowing exactly what you are doing), is to pass the window to the modal dialog to permit access to the parent's variables, etc.
At the point that you are trying to change the contents of the modal dialog, instead fill in some global variables in the parent, close the modal dialog, then immediately open a new modal dialog with the information that you ‘posted’ back to the parent window.
(Not exactly an answer to what you asked, I know, but viable. Seeing what it is that you are up to would help give a more applicable answer.)