Whether you file before or after is not critical, but many other factors may be. Before any more time passes, you really need to consult with an experienced bankruptcy attorney who will do a complete case review and advise on the timing issues.
Best wishes for an outcome you can accept, and please remember to designate a best answer.
This answer is offered as a public service for general information only and may not be relied upon as legal advice.
If there is no reason to wait to file bankruptcy, I always recommend that you file sooner than later. You get the process underway faster and you can rebuild your credit sooner. I have seen people say I am going to wait a few weeks only to realize a year later they should have filed back then.
I would definitely schedule a consultation immediately with a bankruptcy attorney. You need to find out if you can qualify and file a bankruptcy before you think about how a bankruptcy can impact a judgment.
All things being equal, filing BEFORE a lawsuit/judgment is advisable where if you are the owner of any real property (family residence, investment/rental property, etc.). Otherwise, filing after a judgment is entered against you may not make a difference... however, be aware that a judgment creditor may quickly attempt to garnish wages and/or levy bank accounts.
Depending on a host of additional factors including the timing of your bankruptcy filing as it relates to anticipated rising/falling income, your budget (income/expenses... now versus waiting), etc., etc., etc., you may not see much of a difference if choosing to file now OR file later, post-trial/judgment.
As my colleagues have already advised, if you plan to travel down the path of filing bankruptcy, you are wise to consult with a bankruptcy attorney(s) as soon as possible to be sure that your current plan for filing (including the timing of your filing...) will suit your best interests.
Michael Salanick, Esq.
NOTE: we can be reached at www.salanicklaw.com (310) 590-4575. This answer is made available by the lawyer for educational purposes only. By using or participating in this site you understand that there is no attorney client privilege between you and the attorney responding. This site should not be used as a substitute for competent legal advice from a licensed professional attorney with whom you have established an attorney client relationship. The law changes frequently and varies from jurisdiction to jurisdiction. The information and materials provided are general in nature, and may not apply to a specific factual or legal circumstance described in the question.