There are several ways to do it, so depends on what you need to access from engine code.
If you need to access editor classes you should not create the function in a runtime module.
UFunctions can also have a meta flag “DevelopmentOnly” to indicate to users that the node will not execute in a packaged build.