Importing second file in already imported file causing errors?










1















Okay so I have googled this a ton and tried the solutions listed on stackoverflow... but none of them have worked.



I am in anaconda, if that matters. I have a python file called 'mainwithai.py'. In that file, I do:



from SAI import AI_Player


Which works fine. SAI.py is in the same directory as mainwithai. Now, in that same directory, is a file called "getboards.py".



I tried to import this in SAI, not in mainwithai, in the same way, and it failed. I tried it a couple different ways and it fails, based on the different answers I've seen, here are a few:



from . import getboards
import getboards
from .. import getboards
from getboards import *


getboards has no classes, if that matters (SAI.py has a class). Just a collection of functions and some random dictionaries those functions need. It likewise doesn't matter if I try the import in mainwithai or SAI, same errors.



Why does SAI work, and getboards fails? I see that there are .pyc files for mainwithai and sai in the folder; do I need one of those for getboards too?



I've read something about __init__.py, but it sounds like that's for something entirely different than what I'm trying to do; I just want to hit f5 on mainwithai and have it go, not make a package.



EDIT:
Adding output of ls



 Volume in drive D is YSTORAGE
Volume Serial Number is 60BA-9F15

Directory of D:AllStuffwrittenworksStrategoProject

07/27/2018 11:42 AM <DIR> .
07/27/2018 11:42 AM <DIR> ..
01/26/2018 10:14 AM 66 .gitattributes
01/29/2018 11:05 AM 70 .gitignore
11/06/2018 09:17 AM <DIR> __pycache__
12/29/2017 12:26 AM 7,812 AI.py
01/30/2018 11:56 AM <DIR> AI_Mode
01/02/2018 03:22 PM <DIR> backups
12/29/2017 12:42 AM 231 conf.cfg
01/31/2018 09:52 AM <DIR> Database
12/31/2017 09:45 PM 336 empty.txt
12/31/2017 09:28 PM 336 gamestate.txt
11/13/2018 02:57 PM 16,352 getboards.py
12/31/2017 06:27 PM 125,862 gurobi.log
01/26/2018 10:14 AM 35,119 LICENSE
11/13/2018 03:41 PM 34,443 mainwithai.py
01/02/2018 11:11 PM 20,259 mainwithai.pyc
11/08/2018 02:06 PM 16,268 mcts.py
01/24/2018 01:11 PM 0 mintemps.txt
12/29/2017 04:26 PM 1,322 model.ilp
11/08/2018 09:11 AM 8,252,424 neuralstrategoALL.h5
12/31/2017 06:08 PM 6,827 optimization_setup.py
01/29/2018 10:40 AM <DIR> optimizedsetups
01/26/2018 10:14 AM 18 README.md
09/08/2017 03:05 PM <DIR> resources
11/13/2018 03:40 PM 12,747 SAI.py
01/26/2018 01:08 PM 5,666 SAI.pyc
11/06/2018 10:51 AM 8,872 SAIbackup.txt
11/09/2018 11:10 AM 4,226 strategoneural.py
12/31/2017 09:06 PM 337 testtest.txt
12/31/2017 09:00 PM 336 texttext.txt
11/07/2018 04:59 PM 4,992 xmlparse2.py
24 File(s) 8,554,921 bytes
8 Dir(s) 20,052,148,224 bytes free


EDIT 2: here are all the imports at the top of all three files:



mainwithai:



# -*- coding: utf-8 -*-
import configparser
import sys, time, pygame
from pygame.locals import *
import random
import re
from SAI import AI_Player


SAI:



# -*- coding: utf-8 -*-
import random
import numpy as np
import keras
from keras.models import load_model
from copy import copy
import re


getboards:



# -*- coding: utf-8 -*-
import numpy as np
from copy import copy, deepcopy


I don't import anywhere but at the top, that's all of them I checked (I searched the files as a matter of course though), so I don't think it's a circular reference. The only thing they have in common is that getboards has a dictionary with the same name as SAI, but other than that I checked all the function names even; nothing.



EDIT 3: Stacktrace of putting import getboards in SAI.py



runfile('D:/AllStuff/writtenworks/StrategoProject/SAI.py', wdir='D:/AllStuff/writtenworks/StrategoProject')
Traceback (most recent call last):

File "<ipython-input-895-2df6678e9989>", line 1, in <module>
runfile('D:/AllStuff/writtenworks/StrategoProject/SAI.py', wdir='D:/AllStuff/writtenworks/StrategoProject')

File "C:UsersylwallerAppDataLocalContinuumanaconda2envssdev3libsite-packagesspyder_kernelscustomizespydercustomize.py", line 678, in runfile
execfile(filename, namespace)

File "C:UsersylwallerAppDataLocalContinuumanaconda2envssdev3libsite-packagesspyder_kernelscustomizespydercustomize.py", line 106, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "D:/AllStuff/writtenworks/StrategoProject/SAI.py", line 8, in <module>
import getboards

ModuleNotFoundError: No module named 'getboards'









share|improve this question



















  • 1





    How does it fail? And are you sure you don't have a circular import?

    – Matt Messersmith
    Nov 13 '18 at 20:35











  • Nah no circular import, getboards only imports numpy and copy. Ah, I get various forms of "cannot import name 'getboards'" or "No module named 'getboards'" "attempted relative import with no known parent package" (for from .dir import getboards)

    – CapnShanty
    Nov 13 '18 at 20:38






  • 1





    I think import getboards and from getboards import * should work. But yes, you can't do the relative imports (i.e. using . or .. in the import statement) without using __init__.pys (AFAIK). You're sure there are no typos (like you accidentally named it getbaords.py or something?

    – Matt Messersmith
    Nov 13 '18 at 20:40











  • Nah it's sitting right there as getboards.py, this is why I'm confused as from SAI import AI_Player works just fine in mainwithai... so i'm really confused as to why it fails for a different file

    – CapnShanty
    Nov 13 '18 at 20:42






  • 1





    It isn't Anaconda, it's Spyder. Did some googling/reading. You may have found a bug in Spyder.

    – Matt Messersmith
    Nov 13 '18 at 21:29















1















Okay so I have googled this a ton and tried the solutions listed on stackoverflow... but none of them have worked.



I am in anaconda, if that matters. I have a python file called 'mainwithai.py'. In that file, I do:



from SAI import AI_Player


Which works fine. SAI.py is in the same directory as mainwithai. Now, in that same directory, is a file called "getboards.py".



I tried to import this in SAI, not in mainwithai, in the same way, and it failed. I tried it a couple different ways and it fails, based on the different answers I've seen, here are a few:



from . import getboards
import getboards
from .. import getboards
from getboards import *


getboards has no classes, if that matters (SAI.py has a class). Just a collection of functions and some random dictionaries those functions need. It likewise doesn't matter if I try the import in mainwithai or SAI, same errors.



Why does SAI work, and getboards fails? I see that there are .pyc files for mainwithai and sai in the folder; do I need one of those for getboards too?



I've read something about __init__.py, but it sounds like that's for something entirely different than what I'm trying to do; I just want to hit f5 on mainwithai and have it go, not make a package.



EDIT:
Adding output of ls



 Volume in drive D is YSTORAGE
Volume Serial Number is 60BA-9F15

Directory of D:AllStuffwrittenworksStrategoProject

07/27/2018 11:42 AM <DIR> .
07/27/2018 11:42 AM <DIR> ..
01/26/2018 10:14 AM 66 .gitattributes
01/29/2018 11:05 AM 70 .gitignore
11/06/2018 09:17 AM <DIR> __pycache__
12/29/2017 12:26 AM 7,812 AI.py
01/30/2018 11:56 AM <DIR> AI_Mode
01/02/2018 03:22 PM <DIR> backups
12/29/2017 12:42 AM 231 conf.cfg
01/31/2018 09:52 AM <DIR> Database
12/31/2017 09:45 PM 336 empty.txt
12/31/2017 09:28 PM 336 gamestate.txt
11/13/2018 02:57 PM 16,352 getboards.py
12/31/2017 06:27 PM 125,862 gurobi.log
01/26/2018 10:14 AM 35,119 LICENSE
11/13/2018 03:41 PM 34,443 mainwithai.py
01/02/2018 11:11 PM 20,259 mainwithai.pyc
11/08/2018 02:06 PM 16,268 mcts.py
01/24/2018 01:11 PM 0 mintemps.txt
12/29/2017 04:26 PM 1,322 model.ilp
11/08/2018 09:11 AM 8,252,424 neuralstrategoALL.h5
12/31/2017 06:08 PM 6,827 optimization_setup.py
01/29/2018 10:40 AM <DIR> optimizedsetups
01/26/2018 10:14 AM 18 README.md
09/08/2017 03:05 PM <DIR> resources
11/13/2018 03:40 PM 12,747 SAI.py
01/26/2018 01:08 PM 5,666 SAI.pyc
11/06/2018 10:51 AM 8,872 SAIbackup.txt
11/09/2018 11:10 AM 4,226 strategoneural.py
12/31/2017 09:06 PM 337 testtest.txt
12/31/2017 09:00 PM 336 texttext.txt
11/07/2018 04:59 PM 4,992 xmlparse2.py
24 File(s) 8,554,921 bytes
8 Dir(s) 20,052,148,224 bytes free


EDIT 2: here are all the imports at the top of all three files:



mainwithai:



# -*- coding: utf-8 -*-
import configparser
import sys, time, pygame
from pygame.locals import *
import random
import re
from SAI import AI_Player


SAI:



# -*- coding: utf-8 -*-
import random
import numpy as np
import keras
from keras.models import load_model
from copy import copy
import re


getboards:



# -*- coding: utf-8 -*-
import numpy as np
from copy import copy, deepcopy


I don't import anywhere but at the top, that's all of them I checked (I searched the files as a matter of course though), so I don't think it's a circular reference. The only thing they have in common is that getboards has a dictionary with the same name as SAI, but other than that I checked all the function names even; nothing.



EDIT 3: Stacktrace of putting import getboards in SAI.py



runfile('D:/AllStuff/writtenworks/StrategoProject/SAI.py', wdir='D:/AllStuff/writtenworks/StrategoProject')
Traceback (most recent call last):

File "<ipython-input-895-2df6678e9989>", line 1, in <module>
runfile('D:/AllStuff/writtenworks/StrategoProject/SAI.py', wdir='D:/AllStuff/writtenworks/StrategoProject')

File "C:UsersylwallerAppDataLocalContinuumanaconda2envssdev3libsite-packagesspyder_kernelscustomizespydercustomize.py", line 678, in runfile
execfile(filename, namespace)

File "C:UsersylwallerAppDataLocalContinuumanaconda2envssdev3libsite-packagesspyder_kernelscustomizespydercustomize.py", line 106, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "D:/AllStuff/writtenworks/StrategoProject/SAI.py", line 8, in <module>
import getboards

ModuleNotFoundError: No module named 'getboards'









share|improve this question



















  • 1





    How does it fail? And are you sure you don't have a circular import?

    – Matt Messersmith
    Nov 13 '18 at 20:35











  • Nah no circular import, getboards only imports numpy and copy. Ah, I get various forms of "cannot import name 'getboards'" or "No module named 'getboards'" "attempted relative import with no known parent package" (for from .dir import getboards)

    – CapnShanty
    Nov 13 '18 at 20:38






  • 1





    I think import getboards and from getboards import * should work. But yes, you can't do the relative imports (i.e. using . or .. in the import statement) without using __init__.pys (AFAIK). You're sure there are no typos (like you accidentally named it getbaords.py or something?

    – Matt Messersmith
    Nov 13 '18 at 20:40











  • Nah it's sitting right there as getboards.py, this is why I'm confused as from SAI import AI_Player works just fine in mainwithai... so i'm really confused as to why it fails for a different file

    – CapnShanty
    Nov 13 '18 at 20:42






  • 1





    It isn't Anaconda, it's Spyder. Did some googling/reading. You may have found a bug in Spyder.

    – Matt Messersmith
    Nov 13 '18 at 21:29













1












1








1








Okay so I have googled this a ton and tried the solutions listed on stackoverflow... but none of them have worked.



I am in anaconda, if that matters. I have a python file called 'mainwithai.py'. In that file, I do:



from SAI import AI_Player


Which works fine. SAI.py is in the same directory as mainwithai. Now, in that same directory, is a file called "getboards.py".



I tried to import this in SAI, not in mainwithai, in the same way, and it failed. I tried it a couple different ways and it fails, based on the different answers I've seen, here are a few:



from . import getboards
import getboards
from .. import getboards
from getboards import *


getboards has no classes, if that matters (SAI.py has a class). Just a collection of functions and some random dictionaries those functions need. It likewise doesn't matter if I try the import in mainwithai or SAI, same errors.



Why does SAI work, and getboards fails? I see that there are .pyc files for mainwithai and sai in the folder; do I need one of those for getboards too?



I've read something about __init__.py, but it sounds like that's for something entirely different than what I'm trying to do; I just want to hit f5 on mainwithai and have it go, not make a package.



EDIT:
Adding output of ls



 Volume in drive D is YSTORAGE
Volume Serial Number is 60BA-9F15

Directory of D:AllStuffwrittenworksStrategoProject

07/27/2018 11:42 AM <DIR> .
07/27/2018 11:42 AM <DIR> ..
01/26/2018 10:14 AM 66 .gitattributes
01/29/2018 11:05 AM 70 .gitignore
11/06/2018 09:17 AM <DIR> __pycache__
12/29/2017 12:26 AM 7,812 AI.py
01/30/2018 11:56 AM <DIR> AI_Mode
01/02/2018 03:22 PM <DIR> backups
12/29/2017 12:42 AM 231 conf.cfg
01/31/2018 09:52 AM <DIR> Database
12/31/2017 09:45 PM 336 empty.txt
12/31/2017 09:28 PM 336 gamestate.txt
11/13/2018 02:57 PM 16,352 getboards.py
12/31/2017 06:27 PM 125,862 gurobi.log
01/26/2018 10:14 AM 35,119 LICENSE
11/13/2018 03:41 PM 34,443 mainwithai.py
01/02/2018 11:11 PM 20,259 mainwithai.pyc
11/08/2018 02:06 PM 16,268 mcts.py
01/24/2018 01:11 PM 0 mintemps.txt
12/29/2017 04:26 PM 1,322 model.ilp
11/08/2018 09:11 AM 8,252,424 neuralstrategoALL.h5
12/31/2017 06:08 PM 6,827 optimization_setup.py
01/29/2018 10:40 AM <DIR> optimizedsetups
01/26/2018 10:14 AM 18 README.md
09/08/2017 03:05 PM <DIR> resources
11/13/2018 03:40 PM 12,747 SAI.py
01/26/2018 01:08 PM 5,666 SAI.pyc
11/06/2018 10:51 AM 8,872 SAIbackup.txt
11/09/2018 11:10 AM 4,226 strategoneural.py
12/31/2017 09:06 PM 337 testtest.txt
12/31/2017 09:00 PM 336 texttext.txt
11/07/2018 04:59 PM 4,992 xmlparse2.py
24 File(s) 8,554,921 bytes
8 Dir(s) 20,052,148,224 bytes free


EDIT 2: here are all the imports at the top of all three files:



mainwithai:



# -*- coding: utf-8 -*-
import configparser
import sys, time, pygame
from pygame.locals import *
import random
import re
from SAI import AI_Player


SAI:



# -*- coding: utf-8 -*-
import random
import numpy as np
import keras
from keras.models import load_model
from copy import copy
import re


getboards:



# -*- coding: utf-8 -*-
import numpy as np
from copy import copy, deepcopy


I don't import anywhere but at the top, that's all of them I checked (I searched the files as a matter of course though), so I don't think it's a circular reference. The only thing they have in common is that getboards has a dictionary with the same name as SAI, but other than that I checked all the function names even; nothing.



EDIT 3: Stacktrace of putting import getboards in SAI.py



runfile('D:/AllStuff/writtenworks/StrategoProject/SAI.py', wdir='D:/AllStuff/writtenworks/StrategoProject')
Traceback (most recent call last):

File "<ipython-input-895-2df6678e9989>", line 1, in <module>
runfile('D:/AllStuff/writtenworks/StrategoProject/SAI.py', wdir='D:/AllStuff/writtenworks/StrategoProject')

File "C:UsersylwallerAppDataLocalContinuumanaconda2envssdev3libsite-packagesspyder_kernelscustomizespydercustomize.py", line 678, in runfile
execfile(filename, namespace)

File "C:UsersylwallerAppDataLocalContinuumanaconda2envssdev3libsite-packagesspyder_kernelscustomizespydercustomize.py", line 106, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "D:/AllStuff/writtenworks/StrategoProject/SAI.py", line 8, in <module>
import getboards

ModuleNotFoundError: No module named 'getboards'









share|improve this question
















Okay so I have googled this a ton and tried the solutions listed on stackoverflow... but none of them have worked.



I am in anaconda, if that matters. I have a python file called 'mainwithai.py'. In that file, I do:



from SAI import AI_Player


Which works fine. SAI.py is in the same directory as mainwithai. Now, in that same directory, is a file called "getboards.py".



I tried to import this in SAI, not in mainwithai, in the same way, and it failed. I tried it a couple different ways and it fails, based on the different answers I've seen, here are a few:



from . import getboards
import getboards
from .. import getboards
from getboards import *


getboards has no classes, if that matters (SAI.py has a class). Just a collection of functions and some random dictionaries those functions need. It likewise doesn't matter if I try the import in mainwithai or SAI, same errors.



Why does SAI work, and getboards fails? I see that there are .pyc files for mainwithai and sai in the folder; do I need one of those for getboards too?



I've read something about __init__.py, but it sounds like that's for something entirely different than what I'm trying to do; I just want to hit f5 on mainwithai and have it go, not make a package.



EDIT:
Adding output of ls



 Volume in drive D is YSTORAGE
Volume Serial Number is 60BA-9F15

Directory of D:AllStuffwrittenworksStrategoProject

07/27/2018 11:42 AM <DIR> .
07/27/2018 11:42 AM <DIR> ..
01/26/2018 10:14 AM 66 .gitattributes
01/29/2018 11:05 AM 70 .gitignore
11/06/2018 09:17 AM <DIR> __pycache__
12/29/2017 12:26 AM 7,812 AI.py
01/30/2018 11:56 AM <DIR> AI_Mode
01/02/2018 03:22 PM <DIR> backups
12/29/2017 12:42 AM 231 conf.cfg
01/31/2018 09:52 AM <DIR> Database
12/31/2017 09:45 PM 336 empty.txt
12/31/2017 09:28 PM 336 gamestate.txt
11/13/2018 02:57 PM 16,352 getboards.py
12/31/2017 06:27 PM 125,862 gurobi.log
01/26/2018 10:14 AM 35,119 LICENSE
11/13/2018 03:41 PM 34,443 mainwithai.py
01/02/2018 11:11 PM 20,259 mainwithai.pyc
11/08/2018 02:06 PM 16,268 mcts.py
01/24/2018 01:11 PM 0 mintemps.txt
12/29/2017 04:26 PM 1,322 model.ilp
11/08/2018 09:11 AM 8,252,424 neuralstrategoALL.h5
12/31/2017 06:08 PM 6,827 optimization_setup.py
01/29/2018 10:40 AM <DIR> optimizedsetups
01/26/2018 10:14 AM 18 README.md
09/08/2017 03:05 PM <DIR> resources
11/13/2018 03:40 PM 12,747 SAI.py
01/26/2018 01:08 PM 5,666 SAI.pyc
11/06/2018 10:51 AM 8,872 SAIbackup.txt
11/09/2018 11:10 AM 4,226 strategoneural.py
12/31/2017 09:06 PM 337 testtest.txt
12/31/2017 09:00 PM 336 texttext.txt
11/07/2018 04:59 PM 4,992 xmlparse2.py
24 File(s) 8,554,921 bytes
8 Dir(s) 20,052,148,224 bytes free


EDIT 2: here are all the imports at the top of all three files:



mainwithai:



# -*- coding: utf-8 -*-
import configparser
import sys, time, pygame
from pygame.locals import *
import random
import re
from SAI import AI_Player


SAI:



# -*- coding: utf-8 -*-
import random
import numpy as np
import keras
from keras.models import load_model
from copy import copy
import re


getboards:



# -*- coding: utf-8 -*-
import numpy as np
from copy import copy, deepcopy


I don't import anywhere but at the top, that's all of them I checked (I searched the files as a matter of course though), so I don't think it's a circular reference. The only thing they have in common is that getboards has a dictionary with the same name as SAI, but other than that I checked all the function names even; nothing.



EDIT 3: Stacktrace of putting import getboards in SAI.py



runfile('D:/AllStuff/writtenworks/StrategoProject/SAI.py', wdir='D:/AllStuff/writtenworks/StrategoProject')
Traceback (most recent call last):

File "<ipython-input-895-2df6678e9989>", line 1, in <module>
runfile('D:/AllStuff/writtenworks/StrategoProject/SAI.py', wdir='D:/AllStuff/writtenworks/StrategoProject')

File "C:UsersylwallerAppDataLocalContinuumanaconda2envssdev3libsite-packagesspyder_kernelscustomizespydercustomize.py", line 678, in runfile
execfile(filename, namespace)

File "C:UsersylwallerAppDataLocalContinuumanaconda2envssdev3libsite-packagesspyder_kernelscustomizespydercustomize.py", line 106, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "D:/AllStuff/writtenworks/StrategoProject/SAI.py", line 8, in <module>
import getboards

ModuleNotFoundError: No module named 'getboards'






python-3.x python-import importerror






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 '18 at 21:12







CapnShanty

















asked Nov 13 '18 at 20:32









CapnShantyCapnShanty

172111




172111







  • 1





    How does it fail? And are you sure you don't have a circular import?

    – Matt Messersmith
    Nov 13 '18 at 20:35











  • Nah no circular import, getboards only imports numpy and copy. Ah, I get various forms of "cannot import name 'getboards'" or "No module named 'getboards'" "attempted relative import with no known parent package" (for from .dir import getboards)

    – CapnShanty
    Nov 13 '18 at 20:38






  • 1





    I think import getboards and from getboards import * should work. But yes, you can't do the relative imports (i.e. using . or .. in the import statement) without using __init__.pys (AFAIK). You're sure there are no typos (like you accidentally named it getbaords.py or something?

    – Matt Messersmith
    Nov 13 '18 at 20:40











  • Nah it's sitting right there as getboards.py, this is why I'm confused as from SAI import AI_Player works just fine in mainwithai... so i'm really confused as to why it fails for a different file

    – CapnShanty
    Nov 13 '18 at 20:42






  • 1





    It isn't Anaconda, it's Spyder. Did some googling/reading. You may have found a bug in Spyder.

    – Matt Messersmith
    Nov 13 '18 at 21:29












  • 1





    How does it fail? And are you sure you don't have a circular import?

    – Matt Messersmith
    Nov 13 '18 at 20:35











  • Nah no circular import, getboards only imports numpy and copy. Ah, I get various forms of "cannot import name 'getboards'" or "No module named 'getboards'" "attempted relative import with no known parent package" (for from .dir import getboards)

    – CapnShanty
    Nov 13 '18 at 20:38






  • 1





    I think import getboards and from getboards import * should work. But yes, you can't do the relative imports (i.e. using . or .. in the import statement) without using __init__.pys (AFAIK). You're sure there are no typos (like you accidentally named it getbaords.py or something?

    – Matt Messersmith
    Nov 13 '18 at 20:40











  • Nah it's sitting right there as getboards.py, this is why I'm confused as from SAI import AI_Player works just fine in mainwithai... so i'm really confused as to why it fails for a different file

    – CapnShanty
    Nov 13 '18 at 20:42






  • 1





    It isn't Anaconda, it's Spyder. Did some googling/reading. You may have found a bug in Spyder.

    – Matt Messersmith
    Nov 13 '18 at 21:29







1




1





How does it fail? And are you sure you don't have a circular import?

– Matt Messersmith
Nov 13 '18 at 20:35





How does it fail? And are you sure you don't have a circular import?

– Matt Messersmith
Nov 13 '18 at 20:35













Nah no circular import, getboards only imports numpy and copy. Ah, I get various forms of "cannot import name 'getboards'" or "No module named 'getboards'" "attempted relative import with no known parent package" (for from .dir import getboards)

– CapnShanty
Nov 13 '18 at 20:38





Nah no circular import, getboards only imports numpy and copy. Ah, I get various forms of "cannot import name 'getboards'" or "No module named 'getboards'" "attempted relative import with no known parent package" (for from .dir import getboards)

– CapnShanty
Nov 13 '18 at 20:38




1




1





I think import getboards and from getboards import * should work. But yes, you can't do the relative imports (i.e. using . or .. in the import statement) without using __init__.pys (AFAIK). You're sure there are no typos (like you accidentally named it getbaords.py or something?

– Matt Messersmith
Nov 13 '18 at 20:40





I think import getboards and from getboards import * should work. But yes, you can't do the relative imports (i.e. using . or .. in the import statement) without using __init__.pys (AFAIK). You're sure there are no typos (like you accidentally named it getbaords.py or something?

– Matt Messersmith
Nov 13 '18 at 20:40













Nah it's sitting right there as getboards.py, this is why I'm confused as from SAI import AI_Player works just fine in mainwithai... so i'm really confused as to why it fails for a different file

– CapnShanty
Nov 13 '18 at 20:42





Nah it's sitting right there as getboards.py, this is why I'm confused as from SAI import AI_Player works just fine in mainwithai... so i'm really confused as to why it fails for a different file

– CapnShanty
Nov 13 '18 at 20:42




1




1





It isn't Anaconda, it's Spyder. Did some googling/reading. You may have found a bug in Spyder.

– Matt Messersmith
Nov 13 '18 at 21:29





It isn't Anaconda, it's Spyder. Did some googling/reading. You may have found a bug in Spyder.

– Matt Messersmith
Nov 13 '18 at 21:29












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53289061%2fimporting-second-file-in-already-imported-file-causing-errors%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53289061%2fimporting-second-file-in-already-imported-file-causing-errors%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3

Museum of Modern and Contemporary Art of Trento and Rovereto