Hello. Thank you for your message.
According to WebMD - Medical treatment for sleepwalking is necessary when it's caused by an underlying medical problem. In some instances, medications may be prescribed to control sleepwalking. There are also a number of steps a person can take to lessen the impact of sleepwalking.
More information here: https://www.webmd.com/sleep-disorders/how-is-sleepwalking-treated