some modules fail to be loaded when i call a class from a python file

Asked by JOHN

Good evening,
I have the following problem

I have a python script that calls yade functions from another file.

When the other file just has the functions defined as functions (def etc) everything runs correctly

When i wrap the functions in a class i can run the yade engine and some packings, but for example
  pred = inGtsSurface(s) this line cases the error message

NameError: global name 'inGtsSurface' is not defined
And some more seemingly random functionalities fail.
Any ideas/tests you want me to run
Will be more than welcome

Thanks!
John

Question information

Language:
English Edit question
Status:
Expired
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
JOHN (washingmachine) said :
#1

And when i try to put
from yade import pack
and

pack.inG....

i get

  File "/home/john/Desktop/workingclass/myclass.py", line 42, in run
    pred = pack.inGtsSurface(s)
AttributeError: 'module' object has no attribute 'inGtsSurface'

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#2

Could you please narrow down the problem by yourself (it may explain why you don't have much replies)?
For instance, is the problem related to the fact that you manipulate two different script?
If not, is it related to the fact that you call inGtsSurface() from inside the function of a custom class?
If not, are you able to use inGtsSurface() at all in very basic cases?

Bruno

Revision history for this message
JOHN (washingmachine) said :
#3

That is a fair point, i apologize

I feel the issue is that within the class i cant seem to be able to import some modules (the pack module among others)

When i dont wrap those functions in a class it all works perfectly.

I also have a slight suspition that the error might be caused by calling the class from another file, but i dont know how to test it

Unfortunately i am a bit of an amateur and cant really help much

Revision history for this message
Launchpad Janitor (janitor) said :
#4

This question was expired because it remained in the 'Open' state without activity for the last 15 days.