Adding package issue with Julia and VS Code

Julia was working well on my computer until about last month. It appears that adding packages in the code throws an error. Adding a package in the Julia REPL window in VS Code throws no errors. However, running the actual code in the Julia REPL window after manually doing this still causes errors. The error thrown looks like as is below. The package I tried to add was the Plots package:

ERROR: LoadError: UndefVarError: Pkg not defined
Stacktrace:
 [1] top-level scope
   @ ~\Documents\Julia\juliaIssue.jl:4
in expression starting at c:\Users\Prani\Documents\Julia\juliaIssue.jl:4

The code that was running was

Pkg.add("Plots")

Did you call using Pkg first ?