Unable to access variable from other C# script?

I’m making a FPS and I have two scripts. “p_stats” is the statistics for the player (ammo, health, abilities, etc.) and “p_weaponmech” is the script that will change the gun based on class and make the gun fire. For some reason, though I have public variables, it completes the math equation from the p_stats script but fails to see the value in the p_weaponmech script.

p_stats

public class p_stats : Monobehaviour
{
      public int a_main;
      public int a_perclip;
      public int a_clips;

      void Start ()
      {
            a_main = a_clips * a_perclip;
            Debug.Log(a_main.ToString());
      }
}

p_weaponmech

public class p_weaponmech : Monobehaviour
{
      private GameObject p_obj;
      private p_stats stats;
      private int p_ammo;

      void Start
      {
            p_obj = GameObject.Find("Player1");
            p_stats = p_obj.GetComponent<p_stats>();
            p_ammo = p_stats.a_main;
      }
}

I’ve done several “Debug.Log” statements to see if the object was found, if the script was found, etc. and that apparently was not the problem. Any ideas?

You assign p_stats, which is a type, not the member you declared.
Try :

stats = p_obj.GetComponent<p_stats>();
p_ammo = stats.a_main;

I would also encourage you to follow C# naming conventions, class names begins with Upper case, members camelCase, private members begin with an _underscore, etc…

It should make things easier to catch.
My two cents.