title: Fortran Modules - Variable declarations conflict in module with main program
body: <p>I have a FORTRAN 95 code where, in the main program, these variables are declared:</p>
  
  <pre><code>integer :: i
  real(8) :: dx                               
  real(8), allocatable :: X(:), Y(:), Z(:)
  </code></pre>
  
  <p>The following function uses these values at some point during the program:</p>
  
  <pre><code>function Funcion_ceros(var_4)           
          implicit none
          real(8), intent(in) :: var_4(2)
              real(8) :: Funcion_ceros(2)
              Funcion_ceros(1) = var_4(1) - Y(i) - dx*var_4(2)
              Funcion_ceros(2) = var_4(2) - Z(i) - dx*F(X(i + 1), var_4(1), var_4(2))
  end function Funcion_ceros
  </code></pre>
  
  <p>If I include this function in the contains section of the main program, there is no compiling issue. However, when separating it into a module, it loses access to these variables. I attempt to specify the same variabes written above in the module aswell, and get the following error:</p>
  
  <pre><code>Symbol 'i' at (1) conflicts with symbol from  module 'Module_Name', use associated at (2).
  </code></pre>
  
  <p>How do I separate this function into a module, allowing at the same time its access to the variables it uses from the main program?</p>