I have a file structure that looks something like this:
Master:

First


train.py
other1.py

Second


train.py
other2.py

Third


train.py
other3.py


I want to be able to have one Python script that lives in the Master directory that will do the following when executed:

Loop through all the subdirectories (and their subdirectories if they exist)
Run every Python script named train.py in each of them, in whatever order necessary

I know how to execute a given python script from another file (given its name), but I want to create a script that will execute whatever train.py scripts it encounters. Because the train.py scripts are subject to being moved around and being duplicated/deleted, I want to create an adaptable script that will run all those that it finds.
How can I do this?
Which OS are you using ?
If Ubuntu/CentOS try this combination:
import os
//put this in master and this lists every file in master + subdirectories and then after the pipe greps train.py 
train_scripts = os.system("find . -type d | grep train.py  ") 
//next execute them
python train_scripts
Running all Python scripts with the same name across many directories