3
Contributors
5
Replies
6
Views
9 Years
Discussion Span
Last Post by darkMatter2008
0

Could somebody give me a snippet of code, where two classes that exist in different files, with one is calling a user defined static method of the other.

All I can find on the internet is examples where they only work with the static method being called with in the class file. I cannot call that method from another class.

Thanks

0

This is my predicament

class Object1:

	@staticmethod
	def printDamnIT():
		print 'PRINT DAMN IT!' # You can see I'm getting very frustrated

Within another file

import sys
sys.path.append('C:\')
import Object1

Object1.printDamnIT()

Error that I am getting :-

ATTRIBUTEERROR: 'module' object has no attribute 'printDamnIT'

0

The way you are importing to need to use
Object1.Object1.printDamnIT()
to give the namespace too.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.