Python Forum
Python complains that class instance is not defined
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python complains that class instance is not defined
#1
Hello. I have this code line:

instruction = Instruction (byte)
that generates the following error message:

Quote:Traceback (most recent call last):
File "emulator.py", line 29, in <module>
main ()
File "emulator.py", line 21, in main
instruction = Instruction (byte)
NameError: global name 'Instruction' is not defined

Instruction code it is:

class Instruction (object):
	def __init___(self, identifier_byte):
		#type: (byte) ->
		self.identifier_byte = identifier_byte
So, what I am fogetting? Thanks for the input.
Reply


Messages In This Thread
Python complains that class instance is not defined - by colt - Sep-14-2019, 12:07 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  "Name is not defined" when running a class lil_e 6 3,970 Jan-12-2023, 11:57 PM
Last Post: lil_e
  Access instance of a class Pavel_47 5 2,085 Nov-19-2021, 10:05 AM
Last Post: Gribouillis
  Why built in functions are defined as class? quazirfan 5 2,776 Oct-23-2021, 01:20 PM
Last Post: Gribouillis
  Class Instance angus1964 4 2,440 Jun-22-2021, 08:50 AM
Last Post: angus1964
  Error when refering to class defined in 'main' in an imported module HeRo 2 2,377 Apr-13-2021, 07:22 PM
Last Post: HeRo
  Can we access instance variable of parent class in child class using inheritance akdube 3 13,977 Nov-13-2020, 03:43 AM
Last Post: SalsaBeanDip
  "Class already defined" while using typings. DreamingInsanity 0 2,326 Aug-19-2020, 10:43 AM
Last Post: DreamingInsanity
  Issue referencing new instance from other class nanok66 3 2,215 Jul-31-2020, 02:07 AM
Last Post: nanok66
  Class variable / instance variable ifigazsi 9 4,303 Jul-28-2020, 11:40 AM
Last Post: buran
  python library not defined in user defined function johnEmScott 2 3,841 May-30-2020, 04:14 AM
Last Post: DT2000

Forum Jump:

User Panel Messages

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