In order to source a Python file from another python file, you have to use it like a module. import the file you want to run and run its functions. For example, say you want to import fileB.py into fileA.py, assuming the files are in the same directory, inside fileA you'd write
Now in fileA, you can call any function inside fileB like:
In file B you have to define a function called my_func before you can use it in any other file.
def my_func(): print("Hello from B")
Now when you run fileA.py, you will get the output:
Hello from B