title: Using a GenServer from another module
body: <p>I have a simple GenServer and here it is:</p>
  
  <h3>GenServer:</h3>
  
  <pre><code>defmodule MyApp.ScoreTableQueue do
    use GenServer
  
    @impl true
    def init(stack) do
      {:ok, stack}
    end
  
    @impl true
    def handle_call(:pop, _from, state) do
      {:reply, state, []}
    end
  
    @impl true
    def handle_cast({:push, item}, state) do
      {:noreply, [item | state]}
    end
  end
  </code></pre>
  
  <p>I want to use this GenServer in this module:</p>
  
  <h3>MODULE:</h3>
  
  <pre><code>  defp order_score(question, season) do
      for team &lt;- season.teams do
        state = score_table_map(question, team)
  
        # Push state on GenServer queue
      end
  
      create_score_table(question, season)
    end
  
    defp score_table_map(question, team) do
      p_score = Enum.find(team.prediction_scores, &amp;(&amp;1.question_id == question.id))
      %{team_score: p_score.score, team_id: p_score.team_id}
    end
  
    defp create_score_table(question, season) do
      changeset = ScoreTable.changeset(%ScoreTable{
        question_id: question.id,
        season_id: season.id,
        table_details: %{
          information: # Pop state of genserver
        }
      })
  
      Repo.insert(changeset)
    end
  </code></pre>
  
  <p>As pointed out in that code example I want to push some state during a loop on the GenServer and after I want to pop the state on the changeset below. </p>
  
  <p>My main question is how do I initialize the genserver in the other module and is this a best practice?</p>