During a custody proceeding you would file a motion for medical examination and/or drug testing. You will almost certainly need more than just a bare request for such testing, but with testimony as to prior use, any criminal convictions for drug use, and testimony as to erratic behavior, it should not be an impossible goal.
The foregoing is intended as legal information concerning the question asked, but is not intended as legal advice upon which the requesting party may rely in guiding their actions. Rather, the requesting party should consult an attorney for a personal consultation and advice for a full consideration of their situation and rendition of legal advice. Additionally, by providing this general information I am not accepting any representation of the requesting party and I am specifically declining to form an attorney-client relationship with the requesting party unless agreed to later after further consultation and agreement.
Areas of practice listed are are areas of concentration in my practice. I am not board certified in any of the listed areas, and by listing them and describing my practice I am merely describing my experience and the nature of my practice.