How to find the name of current python script running from command line

It is actually very simple. In order to find the name of current python script read form __file__ variable. For example the following python 3 code prints it nicely:

print('I'm running via {:s} file.'.format(__file__)

Note that __file__ is built in and does not require any modules to work.