How can I know if my pain if from my gallbladder or my appendix?

Location, Location.. Gallbladder atttacks tend to cause pain in the right upper- or midline abdomen. Appendicitis usually causes pain in the right lower abdomen. Appendicitis does not "come-and-go", whereas people can have repeated gallbladder attacks. The pain from appendicitis is usually unrelenting, progressively worsening, and makes it difficult to walk or move.
Ask your doc. Ask your doctor. If either of these is giving you problems, you should not be self diagnosing yourself.