Computer Science Canada Multiple Module imports |
Author: | Mistro [ Wed Jun 01, 2005 8:06 pm ] | ||||||||
Post subject: | Multiple Module imports | ||||||||
First of all i would like to say that yes i have infact read over the module tutorial. Infact my question was first posted there. However, since someone mentioned that it should be put here along with the fact that i havn't found a workable solution to it yet, i have made a new post. I have also searched before posting this. Now as for Turing experiance, i have basic experiance with it and i would call myself an intermediate programmer. I do have alot of experiance with other languages such as VB and C++ Now my problem: Lets say i have two modules. How would i go about importing them into my program? It would probably make sense to do soemthing like:
However this generates an error This occurs whenever i import more that two modules. They do not even have to by my own. I also tried to import "GUI" but it also failed when it was second on the list. I then tried putting GUI first, and the error came up but this time on the second "import" which was my file that i had created. Some help would be appreciated. The error is generated at compile. The compiler highlights the second word "import" alone The error message says "syntax error at import) here is the exact code:
this generates an error for the second import (the one for GUI) when flipped like so:
the error occurs on the second import again (this time my own module) Now Delos was kind enough to offer a solution: Quote: You might get a warning popping up there. Import the entire module instead, safer. Easy, wasn't that.
However, if i do something like this:
then i get the same error on the second import. If I put the GUI import first, the error is still on the second import regardless. Thank you in advance for your help EDIT: i should also add that its not just the GUI and that extra file which cause errors. If I use two custom files, the same error comes on the second import statement. If I use two turing Modules, i get the same error again also. |
Author: | lyam_kaskade [ Wed Jun 01, 2005 10:31 pm ] | ||
Post subject: | |||
Try putting your imports all in one line:
I checked it. Got the same syntax error on the second import when I put two, but it worked when they were on the same line. |
Author: | Mistro [ Thu Jun 02, 2005 6:24 am ] | ||||
Post subject: | |||||
ah thanks! that worked ![]()
but this works :
once again thanks. |
Author: | StarGateSG-1 [ Thu Jun 02, 2005 6:35 am ] |
Post subject: | |
that is becasue you don't import the module by itself, you import the whole file or include it. Then you are free to call the module whenever you want. |