Excute script only from another file

Himanshu Garg hgarg.india at gmail.com
Mon Nov 25 02:55:08 CET 2013

I want that a script should only be executed when it is called from another script and should not be directly executable through linux command line.

Like, I have two scripts "scrip1.py" and "script2.py"  and there is a line in "script1.py" to call "script2.py" as subprocess.call(["python", "script2.py"]).

Then this is should call script2 but I should not be able to directly call script2 as $python script2.py

More information about the Python-list mailing list