How to use functions on script file from other folder?

I have a project implemented in matlab and i want to transform it into octave.When i try to run a file on the current directory that uses a function from another directory i get the following error:external methods are only allowed in @-folders while in matlab it was working.I tried to use addpath(genpath(pwd)) from the main folder of the project but it didnt worked.
The structure of the folders is like A(main folder):(includes) B(Current working dir- the dir i want to use the function) and C(Dir in which the script file with the function i want to use is located).

This sounds a little confusing. Let’s get it step by step. You have a collection of functions in your project. That is files like myfun.m with content

function myfun ()
  % ...

Are also script files involved in A, B, or C. That is files without starting with the “function” keyword. If yes, how do they look like and where are they located? Are also classes “classdef” or “@classname-folders” involved?

I have a file A.m which is a class(classdef).This class has as a property stored on a variable which is a part of another class.That class(the .m file) is located in another folder(Both A.m and B.m are classes).The structure of the project is like this:I have a main folder which includes two other folders.In the first folder i have A.m file and in the second folder i have the other .m file from which i use the class in A.m .