Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Import and variable level
#2
you need to pass x as an argument:
#secondary.py
def function(x):
    print("secondary:", x)
 
 
#main.py
from secondary import function
x=0
function(x)
Also, be aware that you set x to 0 prior to running function
Reply


Messages In This Thread
Import and variable level - by tazalapizza - Mar-16-2019, 07:31 PM
RE: Import and variable level - by Larz60+ - Mar-16-2019, 07:47 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Video doing data treatment on a file import-parsing a variable EmBeck87 15 2,855 Apr-17-2023, 06:54 PM
Last Post: EmBeck87
Question How can I import a variable from another script without executing it ThomasFab 12 7,752 May-06-2022, 03:21 PM
Last Post: bowlofred
  python import module or namespace from namepsace variable ? harun2525 11 8,623 May-23-2017, 05:39 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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