Excute script only from another file
Dave Angel
davea at davea.name
Mon Nov 25 07:16:46 EST 2013
On Mon, 25 Nov 2013 02:52:46 -0800 (PST), Himanshu Garg
<hgarg.india at gmail.com> wrote:
> My motive is "I will give scripts to somebody else and he should
not run the script directly without running the parent script".
Perhaps it should be a module, not a script. Have it protect itself
with the usual if __name__ == "__main__"
And of course it gets executed by an import and a call.
--
DaveA
More information about the Python-list
mailing list