A godot script by itself is already a class, so you should not use class Class1
or class Class2
at the start of the file. There are quite a few errors in your code.
The right way to do it would be something like this:
my_class file:
extends Node # Your class can extend from any other node or class, even created ones
# Declaring variables common for the class
var name
var age
var inventory
func _ready():
pass
filethatextendsfromclass.gd file:
extends "res://my_class.gd"
# The vars inherited from the class file could be set on `_init` or any other loop like `_process` or `_fixed_process`
func _ready:
name = "frog" # See, I didn't specify "var" since all the
age = 2 # following variables exists in "my_class.gd"
inventory = ["Master Sword","Water"]
print("Hi, I am ", name, ", ", age," years old and I have: ", inventory) # test-print
pass
As you can see, the very first line of code should be extends "path to the file" or a name of a built in class. After that, it is just a matter of changing the vars on the file.