If you file a Chapter 7 bankruptcy and have received a discharge from the United States Bankruptcy Court then you are free to incur debt whenever you would like. You will need to seek bank approval and provide your discharge documents upon application for your home loan. 

If you have filed a Chapter 13 bankruptcy, then you will need to speak directly with your counsel to find out what is the best way to proceed to buy a home while you are in bankruptcy. In most cases, you will have to seek court approval to buy a home while you are in an active bankruptcy case.