Widgets immediately resetting to default values

I recently tried taking some of my more complex Streamlit functions and placing them into a separate file so that they could be imported as a module and used in multiple projects, but this has caused an unexpected bug. Whenever I use one of the interactive widgets that was created in an imported function, such as a multiselect, it immediately resets to its default state as the app is re-running. Is there any way to fix this behavior?