In mathematica (I am using mma 5.0 ( guess pretty old)), if I type the following as one line:
Needs[\"Graphics`Master`\"]; Animate[Plot[Sin[n x], {x, 0, 2 Pi
You are supposed to put the Needs[] call(s) at the top of a notebook in a separate block, or on the first isolated line of a package.m file.
The kernel reads the whole line and parses it, including deciding on the contexts for symbols, before beginning to evaluate it. To avoid problems, do not use semicolons. Put two newlines after every statement in a package.
Especially after the BeginPackage[] and/or Needs[].