OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Not able to import functions from python file

  • Thread starter Thread starter Coding4Life
  • Start date Start date
C

Coding4Life

Guest
Folder Structure

enter image description here

So I have a masterscript which calls requires.py only. The requires.py is responsible to have call all the necessary supporting files which are in the folder essentials.

Snippet of requires.py

Code:
import os
import sys
import time
from pathlib import *

global formatter 
formatter = "\n #################### =>  "


wokring_dir = os.getcwd()
essential_path = "\essentials"
#forimport = os.path.join(wokring_dir,essential_path)
forimport = (wokring_dir)+essential_path
os.chdir(forimport)
print(formatter,os.getcwd())

from selectthis import printthis
printthis()

Here I am not able to import anythinf from the selectthis. Any suggestions or ideas appreciated. Also I want this to be a portable zip file, anyone should be able to run the master_script in their pc.
<p>Folder Structure</p>
<p><a href="https://i.sstatic.net/8iIs5KTK.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/8iIs5KTK.png" alt="enter image description here" /></a></p>
<p>So I have a masterscript which calls requires.py only. The requires.py is responsible to have call all the necessary supporting files which are in the folder essentials.</p>
<p>Snippet of requires.py</p>
<pre><code>import os
import sys
import time
from pathlib import *

global formatter
formatter = "\n #################### => "


wokring_dir = os.getcwd()
essential_path = "\essentials"
#forimport = os.path.join(wokring_dir,essential_path)
forimport = (wokring_dir)+essential_path
os.chdir(forimport)
print(formatter,os.getcwd())

from selectthis import printthis
printthis()
</code></pre>
<p>Here I am not able to import anythinf from the selectthis. Any suggestions or ideas appreciated. Also I want this to be a portable zip file, anyone should be able to run the master_script in their pc.</p>
 

Latest posts

B
Replies
0
Views
1
Blundering Ecologist
B
Top