Có nhiều cách cho một file Python chạy file khác.
1. Dùng như module. Import file muốn chạy và gọi hàm. Ví dụ import fileB.py vào fileA.py, cùng thư mục, trong fileA:
import fileB
Gọi hàm trong fileB:
fileB.my_func()
2. Dùng lệnh exec.
execfile('file.py')
Thực thi file.py trong interpreter.
3. Tạo tiến trình mới với os.system.
Ví dụ
os.system('python my_file.py')