Is there any way to get tauri::App outside main function?

fn main() {
    let app = tauri::Builder::default()
        .expect("error while building tauri application");

    test(&app);|_app_handle, event| match event {
        tauri::RunEvent::ExitRequested { api, .. } => {
        _ => {}

fn test(app: &tauri::App) {
    let window = app.get_window("main").unwrap();
    if !window.is_devtools_open() {

I tried to get app in the main function.Is it possable to do this outside main?For example,make a function to change menu text in other file?

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.