Offline Functions

Inside the functions folder, create a Python file called os_ops.py. In this file, we'll create various functions to interact with the OS. 

import os
import subprocess as sp

paths = {
    'notepad': "C:\\Program Files\\Notepad++\\notepad++.exe",
    'discord': "C:\\Users\\ashut\\AppData\\Local\\Discord\\app-1.0.9003\\Discord.exe",
    'calculator': "C:\\Windows\\System32\\calc.exe"
}
In the above script, we have created a dictionary called paths which has a software name as the key and its path as the value. You can change the paths as per your system and add more software paths if required. 

 

1. Open Camera

This function will be used to open the camera in our system. We'll be using the subprocess module to run the command.

def open_camera():
    sp.run('start microsoft.windows.camera:', shell=True)
 

2. Open Notepad and Discord

These functions will be used to open Notepad++ and Discord in the system.

def open_notepad():
    os.startfile(paths['notepad'])


def open_discord():
    os.startfile(paths['discord'])


3. Open Command Prompt

This function will be used to open the command prompt in our system.

def open_cmd():
    os.system('start cmd')


4. Open Calculator

This function will be used to open the calculator on our system.

def open_calculator():
    sp.Popen(paths['calculator'])
Discussion
i am finding error in this line from functions.online_ops import find_my_ip which package i need to install to get rid of it

functions.online_ops could not be resolved error please give solution🙏

7

2