Guest User

Untitled

a guest
Mar 21st, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. if __name__ == '__main__':
  2. print('script_2 is the main!')
  3.  
  4. import importlib.util
  5. spec = importlib.util.spec_from_file_location('__main__', 'script_2.py')
  6. mod = importlib.util.module_from_spec(spec)
  7. spec.loader.exec_module(mod)
  8. if __name__ == '__main__':
  9. print('script_3 is the main!')
  10.  
  11. python script_1.py
  12. > script_2 is the main!
  13. > script_1 is the main!
Add Comment
Please, Sign In to add comment