Better way to pass parameters between scenes

I’m working on my mobile learning app. And I use json module to make things like settings, progress meter, data container etc. So, I write each one as a module I require in scene code

I need each module in each scene, but I don’t want to require them from each one. I need to import my modules in one scene, and then make them usable in each file. I’m beginner, so I don’t know many things. But I have 3 ideas how to do it:

  1. I require each my module in main.lua, then I use composer.setVariable ( “myModuleVariable” ). In this case I’ll be able to use all this modules from any scene file by composer.getVariable ( “mMV” )
  2. I also require each my module in main.lua, then I pass this modules in scene params.
  3. First step like in  any previous, but I require modules by setting them to global variables instead of using local. myModule = require “myModuleName” instead of local myModule = require “myModuleName”

I can perform first step not in main.lua, but in some transitional scene. And I think, it’ll he better. But I don’t know which way is better to use, or none of them. Please, help me with it. Thanks

P.S.

The concept of my modules is that module have a few functions it load/save data in files, and have own variable, where it store loaded data. So I need to be able to use this functions from “one instance of module” that is required and created once.

A global settings module is a god way of sharing data between scenes if you have a lot of it.  If it is 1 or 2 then just pass them as parameters.

My approach has been to use a “master module” that requires all the other modules.  Thus, every module can be accessed through the master module with creating circular references.

Check out this forum post

Oh, the post above alsoreferences another post that might be helpful