Ah, if you want to separate the Python files too, then you need to get one file to load the other. This should be easy to do by putting both scripts into the same folder (which you probably did already) and then importing the second file from the first:
# In main_script.py:
import other_script
Now, to present the second view from the main script, but using the functions from other_script, we have to use a small trick. In the other_script, create a function that looks like this:
# In other_script.py:
def load_other_view():
return ui.load_view("other.pyui")
Then you can call this function in your main script to load the other view:
# In main_script.py:
import ui
import other_script
main_view = ui.load_view("main.pyui")
other_view = other_script.load_other_view()
The reason why we need to define the extra load_other_view function in other_script is that ui.load_view looks for action functions and such in the script from which it is called. If we load both views from main_script, it will try to find all action functions there. To load the second view's action functions from the other file, we define the load_other_view helper function that loads other_view.pyui from within other_script. That way other_view.pyui's action functions are always loaded from other_script, even if load_other_view is called from elsewhere.