hi all....

i hav three scripts like

1)memory.py
2)channelmap.py
3)upload.py

i need to run only one script depending upon a selection(i.e,1)memory.py,
2)channelmap.py , 3)upload.py )

is there way to do this

plzzzz help me

Recommended Answers

All 3 Replies

plzzzzzzzzzzzz help me:(

If the scripts main code should be run (no if __name__ == '__main__' condition):

selection = int(raw_input('''Select one:
1) memory
2) channelmap
3) upload
'''))
if selection == 1:
    import memory
elif selection == 2:
    import channelmap
elif selection == 3:
    import upload
else:
    print('Wrong choice')

Better way would be import them all and put the code to run from them in function, which you call depending of choice. Other alternative is to use subprocess.popen or exec.

thanks a lot tonyjv .......

it is working fine:):)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.