How am I supposed to define my modules inside a function? All attempts to call something which requires the module gives me reference error.