Python Forum
global name 'thetime' is not defined
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
global name 'thetime' is not defined
#1
Hi,

So I have three files :

1.) File_INIT.py

The main file that will initialize (mostly) everything.
This file contains definitions for functions function_sub_A up to function_sub_B and so on...

2.) File_A.py

contains function FUNCTION_A

3.) File_B.py

contains function FUNCTION_B

This is roughly what File_INIT.py will look like :

#initialize variables and imports
#...
from File_A import FUNCTION_A
from File_B import FUNCTION_B
#...

def function_sub_A():
     #do something

def function_sub_B():
     #do something else

def thetime():
     #do something else

#and so on

FUNCTION_A()
FUNCTION_B()


#do something
My problem is now that I am using thetime inside FUNCTION_B but it tells me that global name 'thetime' is not defined.
I tried using global thetime within FUNCTION_B but that doesn't make any difference. I also tried that in File_INIT.py at the beginning but that also doesn't help. Any idea what I can do to get thetime to be detected in FUNCTION_B ?
Reply


Messages In This Thread
global name 'thetime' is not defined - by cyberion1985 - Jan-03-2018, 09:52 AM
RE: global name 'thetime' is not defined - by mpd - Jan-03-2018, 01:45 PM
RE: global name 'thetime' is not defined - by mpd - Jan-03-2018, 08:47 PM
RE: global name 'thetime' is not defined - by buran - Jan-03-2018, 09:18 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  python library not defined in user defined function johnEmScott 2 3,911 May-30-2020, 04:14 AM
Last Post: DT2000
  NameError: NameError: global name 'BPLInstruction' is not defined colt 7 4,479 Oct-27-2019, 07:49 AM
Last Post: Larz60+
  Global variable does not seem to be global. Columbo 6 3,756 Jul-15-2019, 11:00 PM
Last Post: Columbo
  NameError: Global Name is not defined MartinBerlin 3 41,303 Aug-25-2018, 09:03 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

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