Trying to create a separate class in a separate python file

I have been trying to get my algo to just spawn one wall to test and understand how to use a different class and not have to have everything all in one. I have tried everything I can think of at the moment. I always come to relatively the same point. Some part of the code will not be defined in some way no mater what I do. This is what I have come too so far.

import gamelib
import random
import math
import warnings
from algo_strategy import *
from sys import maxsize
import json

class BuildDefences(gamelib.AlgoCore):
def phase_one(game_state):
AlgoStrategy.on_game_start(self, config)
gamelib.debug_write(‘Phase One Complete.’)

import gamelib
import random
import math
import warnings
from build import *
from sys import maxsize
import json

class AlgoStrategy(gamelib.AlgoCore):
def init(self):

def on_game_start(self, config):
    gamelib.debug_write('Setting up vars.')
    self.config = config
    WALL = config["unitInformation"][0]["shorthand"]
    SUPPORT = config["unitInformation"][1]["shorthand"]
    TURRET = config["unitInformation"][2]["shorthand"]
    SCOUT = config["unitInformation"][3]["shorthand"]
    DEMOLISHER = config["unitInformation"][4]["shorthand"]
    INTERCEPTOR = config["unitInformation"][5]["shorthand"]
    MP = 1
    SP = 0

def on_turn(self, turn_state):
    game_state = gamelib.GameState(self.config, turn_state)

if name == “main”:
algo = AlgoStrategy()

Last time I did this was back in season one and I just did a basic phase based algo all in one class. Now I want to get more advanced with it so I want to have different classes and methods I call on to make it more organized and practice with that. But I now have no idea how to even get one wall placed. Any help would be very much appreciated. Thank you in advance.

Your error comes from a misunderstanding of how classes work. A class is just a blueprint for an object. It does not really exist as an object in your code until you instantiate it, or create an instance of the class. It is like a blueprint for a house vs actual houses that are built from that blueprint. The blueprint itself is the class and the actual houses themselves are the objects built from the blueprint.

Now to the actual problem. In the on_turn method you are calling BuildDefenses class thinking that it exists as an object, but you have not instantiated it yet. What you should be doing is something like this.

build_defenses = BuildDefenses()

If you’re confused by anything I just said, I’d recommend spending some time on a tutorial regarding classes. here’s a link to the official python documentation on classes. If that seems too dense, there’s plenty of good youtube videos or articles that are more beginner oriented. This is a video I highly recommend that basically explains what I just said but much better.