**the SwiftUI file**
import SwiftUI
import PythonKit
let main = Python.import("main.py")
Button(action:{
main.func($symptoms as! PythonConvertible)
}) {
Image(systemName: "arrowtriangle.forward")
.font(.largeTitle)
.foregroundColor(.black)
.position(x:200, y:-200)
}
**main.py**
from pathlib import Path
from datetime import datetime
from collections import defaultdict
def func():
try:
from googlesearch import search
except ImportError:
print("No module named 'google' found, please install it")
...
Hi I'm relatively new to Swift and iOS app development and I've been trying to write an iOS app which uses a Python script to search google for a result, I've already installed the PythonKit in Xcode but I still can't use the function I defined in main.py, despite referencing it in the SwiftUI file. Every time the button is pressed, the xCode emulator just crashes and macOS returns a lengthy error message. Does anyone know how to do this?