title: Access a singleton across multiple modules
body: <p>I am trying to use the lazy_static crate to create a singleton and use it in a different module. Is that possible or even recommended? I'm still learning how Rust programs should be structured and have been making every file its own module.</p>
  
  <p>I have the following in main.rs and I can access its values</p>
  
  <pre><code>lazy_static! {
      static ref GAMEDATA: gamedata::data::GameDataS =
          gamedata::data::load_data("./src/assets/data.json".to_string());
  }
  
  fn main() {
      println!("data{}", GAMEDATA.width);
  }
  </code></pre>
  
  <p>When trying to access <code>GAMEDATA</code> in a different module, I get</p>
  
  <blockquote>
    <p>not found in this scope</p>
  </blockquote>
  
  <p>for example in a module called <code>game</code></p>
  
  <pre><code>pub struct Game {}
  impl Game {
      println!("data{}", GAMEDATA.width);
  }
  </code></pre>
  
  <p>Is it possible to make a global variable across all modules? Is there some other way I should be thinking about it? Perhaps not using modules as often?</p>