Reputation: 5162
As an example: I have a python script scip.py with
from sys import argv
# parsing the input
script, NU = argv
def main(NU):
return
def somefunc():
return
if __name__ == '__main__':
main(NU)
Assume I am in a [I]python shell. I can run the script e.g. via run scip.py 1
. But how can I import the functions from it? import scip
fails, because it needs variables to unpack. import scip 1
gives a SyntaxError.
Upvotes: 0
Views: 142
Reputation: 16029
this should do the trick:
def main(NU):
return
def somefunc():
return
if __name__ == '__main__':
from sys import argv
# parsing the input
script, NU = argv
main(NU)
Upvotes: 1