Defining a class within a app definition

I am unable to save an app file with a custom class definition in it, with the error

Importing [AWSSRP] is not allowed Expression [MethodCallExpression] is not allowed: org.codehaus.groovy.runtime.InvokerHelper.runScript(Script1, args) at line number -1

class AWSSRP {
....
}


def version() {"1.0.0"}
def appVersion() { return version() }
def appName() { return "Schlage Wifi Locks Support" }

definition(
    name: "${appName()}",
    namespace: "schwark",
    author: "Schwark Satyavolu",
    description: "This adds support for Schlage Wifi Locks",
    category: "Convenience",
    iconUrl: "https://play-lh.googleusercontent.com/7IH82e5JiqI2_a9oWndaDyBETXtV45a-QhW_0f-ekADl6W2A3Q0u_vEWQHfQF0D-Flg=w600-h300-pc0xffffff-pd",
    iconX2Url: "https://play-lh.googleusercontent.com/7IH82e5JiqI2_a9oWndaDyBETXtV45a-QhW_0f-ekADl6W2A3Q0u_vEWQHfQF0D-Flg=w600-h300-pc0xffffff-pd",
    singleInstance: true,
    importUrl: "https://raw.githubusercontent.com/schwark/hubitat-schlage/main/schlage.groovy"
)

Can I not put functionality into a class defined in this file? Is there another way to do this?

For anyone else looking for the answer to this question - you cannot. You have to unroll your class into the app or driver..

Correct. I would suggest reading the Developer Overview if you have not already, specifically the "Development Environment" section, which notes this issue (among others you may need to know if you are not used to the sandbox).