If I understand you correctly, you probably want a reference to the Weapon component that’s on an object. You can use GetComponent():
var gun : Weapon;
// Get a reference to the first Weapon component found on the game object:
gun = GetComponent(Weapon);
// Always check for null, in case none was found:
if (gun == null) Debug.LogError("No Weapon component found!");
// What the heck, I'm not sure why you'd do this, but
// this sets the Weapon class's thisGun variable to
// point to its own game object, since this component
// is on the same game object:
gun.thisGun = this.gameObject;
I give 50/50 odds that I understand your question correctly. If I totally missed it, read that link above.