code: def convertVariable(self, key, varName, varValue):
          
          if isinstance(varValue, encapsulation.FunctionEncapsulation):
              result = varValue.getFunction()
  
              # Update the global scope of the function to match the current module
              mainModule = sys.modules["__main__"]
              result.__name__ = varName
              result.__globals__.update(mainModule.__dict__)
              setattr(mainModule, varName, result)
              shared.elements[key].update({
                  varName: result,
              })
docs: Puts the function in the globals() of the main module.