The act of foreclosing on a property is a form of "debt collection". In bankruptcy, there is what is called an "automatic stay" that prohibits debt collection activity by creditors from proceeding (usually only until a "plan" has been presented to the BK court). Of course, it becomes necessary to inform the creditors of the bankruptcy filing; once that happens, they usually back off and wait for discharge or the more common dismissal of the bankruptcy.
IMO, the bankruptcy attorney should be aware of how to proceed - this stuff happens in their practice.
A few months back I was at the sheriff sale for my county. A certain property was going to foreclosure; the sheriff asked the "attorney on the writ" (the lender's attorney) for a bid. Attorney replied that he had recieved a call that the defendant had said they were filing bankruptcy, and that he was awaiting for the FAX confirmation of that to be sent to his office; he then requested that his case be deferred to the end of the sale to allow for the confirmation to happen. That FAX apparently never came, and it was auctioned at the end. But this shows that the debt collection activity is deliberately avoided if there is a true bankruptcy, and not just somebody saying so just to postpone the matter.