same directory

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/8dd9fe38-0bb7-4ac8-83e2-06a92190910e/Untitled.png

import

print('import my_modeule...')

test = 'Test String'

def find_index(to_search, target):
	'''Find the index of a value in a sequence'''
	for i, value in enumerate(to_search):
		if value == target:
			return i
	return -1
import python_tutorial

courses = ['History', 'Math', 'Physics', 'Compsci']

index = python_tutorial.find_index(courses, 'Math')
print(index)

'''
out:
import my_modeule...
1
[Finished in 93ms]
'''

import ... as ...

import python_tutorial as pt

courses = ['History', 'Math', 'Physics', 'Compsci']

index = pt.find_index(courses, 'Math')
print(index)

from ... import ... (as ...)

from python_tutorial import find_index
courses = ['History', 'Math', 'Physics', 'Compsci']

index = find_index(courses, 'Math')
print(index)
from python_tutorial import find_index, test
courses = ['History', 'Math', 'Physics', 'Compsci']

index = find_index(courses, 'Math')
print(index)
print(test)
'''
out:
import my_modeule...
1
Test String
[Finished in 67ms]
'''

from ... import *

from python_tutorial import *
courses = ['History', 'Math', 'Physics', 'Compsci']

index = find_index(courses, 'Math')
print(index)
print(test)
'''
out:
import my_modeule...
1
Test String
[Finished in 76ms]
'''

Different directory

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/ea29ae3e-7053-41db-bf92-f2780b9051e4/Untitled.png