Python Forum
passing-arguments-from-one-script-to-another
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
passing-arguments-from-one-script-to-another
#8
Without seeing all your code I cannot think of a reason why you are using main.py. Why doesn't telnet.py ask for the mac address? However, from the info provided in your last post I see no reason why your code does not work. Essentially it is the same as this.
page1.py
value = input('Enter a value:')
page2.py
import page1
print('The value is', page1.value)
Output:
Enter value: 5 The value is 5
I re-read your posts more carefully this time. Upon further reflection it sounds like there is no need for telnet.py. You should write a function that does what telnet.py does. Actually you should write a function that inputs the mac address, computes the IP address, and returns the computed IP address. Your main program would call this function just like any of the standard functions. Now you only have 1 module and don't have to worry about global variables.
Reply


Messages In This Thread
RE: passing-arguments-from-one-script-to-another - by deanhystad - Apr-21-2020, 03:55 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Problems passing arguments containing spaces to bash script and then on to python kaustin 6 656 Apr-03-2024, 08:26 PM
Last Post: deanhystad
  Passing writable arguments to functions. Assembler 11 1,223 Jan-15-2024, 11:32 PM
Last Post: sgrey
  Passing string functions as arguments Clunk_Head 3 1,346 Jun-15-2022, 06:00 AM
Last Post: Gribouillis
  Passing flags to python script, through a function xbit 4 4,128 Apr-20-2021, 06:32 AM
Last Post: ndc85430
  redirect url_for passing arguments with the url Leon79 1 1,712 Jul-09-2020, 05:20 PM
Last Post: Leon79
  How to write a script to execute a program need passing additional input? larkypython 2 2,673 Nov-23-2019, 04:38 AM
Last Post: larkypython
  Still confused about how passing arguments works RedSkeleton007 3 3,045 Apr-25-2018, 11:01 AM
Last Post: snippsat
  Trouble passing arguments underoathed 2 3,030 Nov-13-2017, 04:20 PM
Last Post: underoathed
  Functions (Arguments Passing,Changing a mutable ,Assignment to Arguments Names) Adelton 2 3,953 Mar-02-2017, 10:23 PM
Last Post: zivoni
  multiprocess passing multiple arguments double asterisk pic8690 1 5,374 Oct-23-2016, 08:51 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020