When you file a bankruptcy petition, the law imposes what is called an automatic stay. What this means is that creditors are prohibited, as a matter of law, from contacting you. They cannot telephone you, they cannot write to you, and they cannot have collection agencies pursue you.
If they do, then you can proceed, in the bankruptcy court, to seek to have sanctions imposed against the creditors. That would include fines or attorney’s fees, incurred by you, in seeking to have the sanctions imposed by the court. So once you file, the harassment should stop.