Is there a possibility to pass data between two modules?

Is there a possibility to pass data between two modules ?
I got to modules with structs in them
I want to pass data from module1 to module2

module moduleOne
 # how would I get the data from moduleTwo?
end

module moduleTwo
  struct dataTwo
    test::String  
  end
end```
module moduleTwo
  struct dataTwo
    test::String  
  end
end

module moduleOne
    import Main.moduleTwo: dataTwo
    a = dataTwo("hey")
    @show a
end

But let’s say I have a function in moduleTwo (The module I want to get data from)

module moduleOne

  # How would I get the structure from moduleTwo? the one I create in the init function

end

module moduleTwo
  struct Self
    token::String
  end

  function init(token::String)
    structure = Self(token)
    connect(structure) # a function to connect the client to a websocket, unnecessary for now 
  end
end

You can have a global binding in moduleTwo and import that name in moduleOne. However, moduleOne definition should come later, I think.

Can you please write an example (in code)

I didn’t test I am on a mobile phone but something like

module moduleTwo
  struct Self
    token::String
  end
  
  function init(token::String)
    global structure = Self(token)
    connect(structure) # a function to connect the client to a websocket, unnecessary for now 
  end
end

module moduleOne
import Main.moduleTwo: structure
#use structure
end

Seems like it did the job, thank you very much :slight_smile:

Just pass the information as the argument to a function.