On 22Jan2015 17:11, jarod...@libero.it <jarod...@libero.it> wrote:
I created a class that invoke  from another file another class
I get an error that I do not understand: gobal name Job is not defined
However If I see the class imported I found the class Job.
Any suggestion or example on class invoke another class

First, please cut/paste error messages, filenames and code. Do not hand type them, as that introduces errors.

#job,py

For example, I suspect you mean "job.py", not "job,py".

class Jobs:
   .....

#trial.py

from core.job import *

It is not recommended to import "*". Just impor the names you need. It avoids _unexpected_ names leaking into your program: you might be using such a name for something else!

class Second:
   def __initi__:
       tp = open("/tmp/file.txt")

   def gus(self):
       tr = Job()

Because you have hand typed things I cannot be sure - it may just be a mistake - but "job.py" defines a class "Jobs". In "trial.py" you use the name "Job".
Not the same!

Cheers,
Cameron Simpson <c...@zip.com.au>

Beware of bugs in the above code; I have only proved it correct, not tried it.
- Donald E. Knuth
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to