# Oops! you have loaded package pgf after bidi package

I keep getting this error in my TeXStudio:

Package bidi Error: Oops! you have loaded package pgf after bidi package. Pleocument again. \begin{document}


What does it mean?

• Call the pgf package before bidi. (\usepackage{pgf} and then \usepackage{bidi}) Jan 6, 2016 at 20:07

You are probably not loading pgf directly; it's more likely that you are loading tikz or pgfplots, or some other package that depends on tikz. Just make sure you load this before loading bidi. Since bidi modifies lots of package behaviour to work with RTL languages, it's generally best to load it last in the order. You may not be even loading bidi directly either, but it gets loaded, for example when you set the language using the polyglossia package, or the xepersian package so you should load that later too.
From the xepersian documentation (Section 2: Basics):
1. xepersian should be the last package that you load, because otherwise you are certainly going to overwrite bidi and XePersian package’s definitions and consequently, you will not get the expected output.