If you cannot record the action in a Journal, it is possible that there is no API for that yet.
But if you are running NX10, you could try switching to the modeling application with the ApplicationSwitchImmediate() method, which is part of the Session class. (I have not tested this in the situation that you described.)
You need to delete the PostView to return to the model. If you have created the postview in your code, you should have the postview ID that was assigned on creation. Use Session.Post.PostviewDelete() to delete it.
The following python code will blindly delete all post views that exist:
import NXOpen theSession = NXOpen.Session.GetSession() theLw = theSession.ListingWindow def main(): theLw.Open() for postId in theSession.Post.GetPostviewIds(): theLw.WriteLine("Closing Postview ID: " + str(postId)) theSession.Post.PostviewDelete(postId) # Main program. if __name__ == "__main__": main()